Group Abstract Group Abstract

Message Boards Message Boards

Graphics overlay doesn't work properly

Posted 2 years ago
Attachments:
POSTED BY: Joel Tenenbaum
5 Replies
Attachments:
POSTED BY: Joel Tenenbaum

You have probably flattened too much. You have to flatten only to level 1: Flatten[matrix 1], so that you have a list of triples.

POSTED BY: Gianluca Gorni

It seems to me that you are feeding ListContourPlot a simple matrix of speed values. This way the frame labels will only note the position within the matrix. To get more meaningful frame labels you should give a list (not a matrix) of triples {pressure, latitude, speed} or whatever. Compare the labels:

ListContourPlot[Table[Sin[i + j^2], {i, -1, 2, 0.1},
  {j, 0, 3, 0.1}]]
ListContourPlot[Flatten[Table[{j, i, Sin[i + j^2]},
   {i, -1, 2, 0.1}, {j, 0, 3, 0.1}], 1]]

As for adding lines on top of the contour plot, I would recommend Epilog:

ListContourPlot[Table[Sin[i + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}],
 Epilog -> {Line[{{-20, -20}, {20, 20}}]}]
POSTED BY: Gianluca Gorni

Thanks for the suggestions. Some background: the difference between gLEV1 and gLEV2 is to get the axis labels to be the meteorologically appropriate values, with fake negative pressures to get the correct vertical display of atmospheric pressure (-150 hPa at top) and Latitude (60N to 40N). The figure is a slice of wind speed through the jet stream.

When I put gLEV2 at the start, i.e. Show[{gLEV2, lineLONGRA, lineTRKGRA, lineTURGRA}] I get a blank display box but otherwise proper x and y axis labels and the color legends.

Which function, ListContourPlot or Show takes the PlotRange parameters? Am I understanding correctly that these should be -350 to -150 (negative pressure in hectoPascals) and -70 to 0 ( i.e. west Longitude)

Joel

POSTED BY: Joel Tenenbaum

It appears to be a problem of PlotRange. When you Show more than one plot, the overlay will use the PlotRange of the first plot. Also, if gLEV2 is last, it will sit on top of the previous lines and make them invisible underneath. Place gLEV2 first in the list:

Show[gLEV2,lineLONGRA, lineTRKGRA, lineTURGRA]

Otherwise, use Epilog within ListContourPlot. By the way, there is no need for Show when only one Graphics is inside: Show[Graphics[lineLONCUR]] is the same as Graphics[lineLONCUR]

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard