Tag Info

New answers tagged

3

This happens because legend items are wrapped in HoldForm to prevent the elements from taking on values: Observe: c = 5; RegionPlot[{x^2 + y^2 <= c, x < 0}, {x, -Pi, Pi}, {y, -Pi, Pi}, PlotLegends -> "Expressions"][[2, 1, 2]] // InputForm {HoldForm[x^2 + y^2 <= c], HoldForm[x < 0]} Without the HoldForm any global values (such as c ...


6

Update: Generate a separate legend with the default color scheme and export it: lineleg = LineLegend["DefaultPlotStyle"/. (Method/. Charting`ResolvePlotTheme[Automatic, ListLinePlot]), {"leg1", "leg2", "leg3"}]; Export["plotlegend.pdf",lineleg] To get the default colors associated with various PlotThemes you can use the function ...


7

Using either Swatchlegend, PointLegend, LineLegend, Barlegend you can easily generate a legend like you would get in a plot. SwatchLegend[{Red, Green, Blue}, {"red", "green", "blue"}] PointLegend[{Red, Green, Blue}, {"red", "green", "blue"}] LineLegend[{Red, Green, Blue}, {"red", "green", "blue"}] BarLegend["Rainbow"] Non-default styles are ...


5

Legended[ContourPlot[x y, {x, 0, 1}, {y, 0, 1}], Placed[BarLegend[{ColorData["M10DefaultDensityGradient"], {0, 1}}, LegendLayout -> "Row"], Below]] I found the name of the color scheme by evaluating plot = ContourPlot[x y, {x, 0, 1}, {y, 0, 1}, PlotLegends -> Automatic] and looking at the expression of the result. As Legended accepts two ...


0

Following Verbeia's advice, I tried to use the existing functions built in Mathematica and tried to make simple as possible. I was able to slim down my code. It looks simpler and cleaner. Thank you Verbeia for your advice. ClearAll["Global`*"] σ = 5.67*^-8;(*Stefan-Boltzmann Constant*) ϵ = 1;(*Emissivity*) α = 1;(*Absorbtivity*) τ = 1;(*Transmittance*) g = ...


2

My main suggestion would be to use existing legending functionality in version 9+, e.g. LineLegend rather than hack things together from scratch like this. I think the main issue with your code and the reason it does not work, is that you are not actually providing any means for text-formatting options to affect your labels. The relevant piece of code in ...



Top 50 recent answers are included