Heat map + legend: Difference between revisions

From Wiki
Jump to navigation Jump to search
Cvargas (talk | contribs)
No edit summary
Cvargas (talk | contribs)
No edit summary
Line 1: Line 1:
go back to [[Main Page]], [[Computational Resources]], [[Scripts]]
go back to [[Main Page]], [[Computational Resources]], [[Scripts]], [[Scripts for Mathematica 8]]


go back to [[Main Page]], [[Computational Resources]], [[Chemistry & More]], [[Computational Codes]], [[MATHEMATICA]], [[Scripts for Mathematica 8]]
go back to [[Main Page]], [[Computational Resources]], [[Chemistry & More]], [[Computational Codes]], [[MATHEMATICA]]


  c1 = Import ["path/file.csv"] (*The file.csv must be in the shape [[matrix]]*)
  c1 = Import ["path/file.csv"] (*The file.csv must be in the shape [[matrix]]*)

Revision as of 15:07, 13 September 2011

go back to Main Page, Computational Resources, Scripts, Scripts for Mathematica 8

go back to Main Page, Computational Resources, Chemistry & More, Computational Codes, MATHEMATICA

c1 = Import ["path/file.csv"] (*The file.csv must be in the shape matrix*)
Grid[c1] (*To see how the matrix looks like*)
n1 = c1[[2 ;; All, 2 ;; All]] (*To extract only the numerical part of the matrix *)
Grid[n1] (*To see how the numerical matrix looks like*)
l1 = c1[[2 ;; All, 1]] (*Width of a line*)
p1 = c1[[1, 2 ;; All]] (*Height of a column*)
nn1 = Rescale[#] & /@ n1 (*Rescale[n1] per line*)
(*Heat map plotted  Heat_map*) 
  ArrayPlot[nn1, ColorFunction -> "Rainbow", ColorFunctionScaling -> False, AspectRatio -> 0.9, Frame -> True, FrameStyle -> Opacity[0], 
  FrameTicks -> {{Transpose[{Range[Length[l1]], l1}</nowiki>], None}, {None, Transpose[{Range[Length[p1]], Map<nowiki>[Rotate[#, 50 Degree] &, p1]}]}}, 
  FrameTicksStyle -> Directive[Opacity[1], Bold, FontSize -> 22, FontFamily -> "Helvetica"], Mesh -> All, MeshStyle -> White]


(*Generate lengend  Legend*)
  q = DensityPlot[x, {x, 0, 1}, {y, 0, 0.1}, AspectRatio -> Automatic, FrameTicks -> None, ColorFunction -> "Rainbow", PlotRangePadding -> None];
   l = Show[q, ImageSize -> 200, Frame -> True, FrameTicks -> {{None, None}, {{{0, Min[n1<nowiki>[[All, 2]]]}, {1, Max[n1[[All, 2]]]}}, None}}]