Thursday 15 September 2011

python - control axes in matplotlib dynamically -


I am trying to generate a heat map using matplotlib. Import the imported sys as NP imported sys (imported as plat.pcolor (data) with the imported plt (numerical = 10, 10) with numpy = np.random.rand import matplotlib .pyplot (sys.argv [1], iFile as 'R'): for line in iFile: line = line.strip () value = re.split ('[-:]', line) x = values [0] .strip () y = value [1] .strip () z = value [2] .strip () data [y, x] = z in the range for y (data. [0] size: x In the range (data.shape [1]): plt.text (x + 0.5, Y + 0.5, '% .2f'% data [y, x], horizontalalignment = 'center', verticalalignment = 'center', ) Plt.colorbar (heatmap) plt.show ()

and day The "x-y: value" in the format is

  6 - 4: .180671274019055 6 - 1: .30475569499109 6 - 3: .276460025706412 6 - 2: .298002584369681 ... ... 1 - 4: .0961071651182192 1 - 1: .259655770346209 1 - 3: .308485173534571 1 - 2: .278724535194018   

Question: The X and Y values ​​are quite dynamic and are different (1 to 6 here). I want to set the characters based on the input file dynamically. Any help would be much appreciated, thanks!

Apart from this, many other axial heripulation routines, if you search around the API page.

No comments:

Post a Comment