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 17: Line 17:
  nn1 = Rescale<nowiki>[#]</nowiki> & /@ n1 (*Rescale<nowiki>[n1]</nowiki> per line*)
  nn1 = Rescale<nowiki>[#]</nowiki> & /@ n1 (*Rescale<nowiki>[n1]</nowiki> per line*)


  (*Heat map plotted [[Heat_map]]*)  
  (*Heat map plotted Example -->[[Heat_map]]*)  
   ArrayPlot[nn1, ColorFunction -> "Rainbow", ColorFunctionScaling -> False, AspectRatio -> 0.9, Frame -> True, FrameStyle -> Opacity<nowiki>[0</nowiki>],  
   ArrayPlot[nn1, ColorFunction -> "Rainbow", ColorFunctionScaling -> False, AspectRatio -> 0.9, Frame -> True, FrameStyle -> Opacity<nowiki>[0</nowiki>],  
   FrameTicks -> {{Transpose<nowiki>[{Range[Length[l1</nowiki>]], l1}</nowiki>], None}, {None, Transpose<nowiki>[{Range[Length[p1]], Map<nowiki>[Rotate[#, 50 Degree] &, p1]}</nowiki>]}},  
   FrameTicks -> {{Transpose<nowiki>[{Range[Length[l1</nowiki>]], l1}</nowiki>], None}, {None, Transpose<nowiki>[{Range[Length[p1]], Map<nowiki>[Rotate[#, 50 Degree] &, p1]}</nowiki>]}},  
Line 23: Line 23:


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

Revision as of 15:10, 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 Example -->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 Example -->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}}]