How to combine many plots with different colors

  • Thread starter ggeo1
  • Start date
  • Tags
    Plots
In summary, the conversation discusses how to combine multiple plots with different colors in one plot using Mathematica. The show command is not recognizing the PlotStyle command, and the solution is to make sure the original plots are created with the desired colors and then combine them using show. Alternatively, if the plots are slow to generate, the underlying expression can be edited using a replacement rule to change the color.
  • #1
ggeo1
63
0
Hello,

as i say in title,my question is how to combine many plots with different colors in one plot.

The problem is that the show command doesn't recognize the PlotStyle command.

Thank you
 
Physics news on Phys.org
  • #3
Hello

I tried this
Code:
 Plot[{graph1, graph2, graph3}, {t, 0, tmax}, 
 PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0], 
   RGBColor[0, 0, 1]}]

but it doesn't return any result.

My graph1 is
Code:
graph1 = Plot[Evaluate[FLI[t]], {t, 0, tmax}, PlotRange -> All, 
  PlotStyle -> RGBColor[0, 0.5, 1]]

but i don't know how to combine them.

Thanks
 
  • #4
Show only combines Graphics objects, it doesn't change them.
Make your original graphs with the colors that you want, then combine with show.

If your plots are really slow to generate, then you can edit the underlying expression with a replacement rule. Eg
g1 = Plot[x^2, {x, -3, 3}]
produces the standard blue line.
g1//FullForm
shows the full expression, you see the blue is Hue[0.67, 0.6, 0.6], so you can make it red by
g1 /. Hue[0.67, 0.6, 0.6] :> RGBColor[1, 0, 0]
 
  • #5
Ok thanks!

I used PlotStyle in every plot ,so the show command gave all three plots with their color.
 

Related to How to combine many plots with different colors

1. How can I combine multiple plots with different colors into one figure?

To combine multiple plots with different colors into one figure, you can use the "hold on" command in MATLAB or the "par(mfrow)" function in R. This will allow you to plot each individual plot separately, but they will all appear on the same figure.

2. Can I customize the colors of each plot when combining them into one figure?

Yes, you can customize the colors of each plot by specifying the color in the plot function. For example, in MATLAB, you can use the "Color" property and in R, you can use the "col" argument to specify the desired color for each plot.

3. Is it possible to combine plots with different color palettes into one figure?

Yes, you can combine plots with different color palettes into one figure by using the "hold on" command or the "par(mfrow)" function. However, it is important to choose a color palette that is visually appealing and does not create confusion or distraction in the figure.

4. Can I add a legend to a figure with multiple plots and different colors?

Yes, you can add a legend to a figure with multiple plots and different colors by using the "legend" function in MATLAB or the "legend()" function in R. Make sure to specify the labels for each plot in the respective plot function to ensure the legend appears correctly.

5. How do I ensure that the colors in the combined plot are visually pleasing and easy to interpret?

To ensure that the colors in the combined plot are visually pleasing and easy to interpret, it is important to choose a color scheme that is complementary and has enough contrast between the colors. You can also use tools such as ColorBrewer or Adobe Color to generate color palettes that are optimized for data visualization.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
870
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
833
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top