Re: color-bar legend for the LisContourPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg123566] Re: color-bar legend for the LisContourPlot
- From: Armand Tamzarian <mike.honeychurch at gmail.com>
- Date: Sun, 11 Dec 2011 03:48:28 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201112091054.FAA03755@smc.vnet.net> <jbvjp4$j20$1@smc.vnet.net>
On Dec 10, 11:36 pm, Jacopo Bertolotti <jacopo.bertolo... at gmail.com> wrote: > I encountered a very similar problem and I am also searching for a > solution that do not involve either ShowLegend or a third-part package. > The very best I came up with is something like > GraphicsRow[{ListContourPlot[RandomReal[30, {10, 10}], > InterpolationOrder -> 3, ColorFunction -> "LakeColors"], > MatrixPlot[Transpose@{Table[i, {i, 1, 30}]}, > FrameTicks -> {{None, {1, 10, 20, 30}}, {None, None}}, > ColorFunction -> "LakeColors"]}] > that is still far from ideal. Anyone with suggestions is welcomed. > > Jacopo > > On 12/09/2011 11:54 AM, Karamiarokhloo, M.P. (Mehdipasha) wrote: > > > > > > > > > Dear All, > > > I am using Mathematica 7 and have difficulties to plot the ListContourPlot > > of ocean data with a neat color bar (legend). > > For example if I have a temperature field range between {-2,30}, and I use > > the ColorFunction Rainbow, > > I cannot include a color-bar which has the same number of contours as the contourplot, and it does not show the related numbers for each color-shade. > > The ShowLegend function of Mathematica is very primitive. > > Has any body any suggestion? > > > Thanks you. > > P.Karami BTW in the post I sent a few minutes ago I noticed that the legend colours aren't scaled right. I'm not sure why actually. ColorFunctionScaling should scale between 0 and 1 that but it doesn't appear to be doing that -- unless I am misunderstanding the usage. I never use these plot types so I might be missing something but would be interested if someone could explain. In any case if you rescale yourself and switch ColorFunctionScaling off it seems to work: MatrixPlot[Transpose@{Table[i, {i, 0, 30}]/30}, AspectRatio -> plotheights/legendwidth, FrameTicks -> {{None, {1, 10, 20, 30}}, {None, None}}, ImageSize -> {legendwidth + 21, plotheights + 2}, PlotRangePadding -> 0, ImagePadding -> {{1, 20}, {1, 1}}, ColorFunction -> "LakeColors", ColorFunctionScaling -> False] Mike
- References:
- color-bar legend for the LisContourPlot
- From: "Karamiarokhloo, M.P. (Mehdipasha)" <M.P.Karamiarokhloo@uu.nl>
- color-bar legend for the LisContourPlot