Message Boards Message Boards

0
|
1203 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to use PlotStyle when using PlotLayout option

Hello community,

I am experiencing a strange behavior with the PlotLayout option. I have the following example code:

data = Table[
   Table[{x, f}, {x, 0, 2 Pi, 0.1}], {f, {Sin[x], Sin[2 x]}}];

ListPlot[data, PlotStyle -> {Blue, Red}, PlotLayout -> "Row"]

Without using the PlotLayout option, the plots are displayed correctly with one in blue and the other in red. However, when I use the PlotLayout -> "Row" option, both plots are printed in red. This behavior seems unexpected, and I'm having trouble understanding why this is happening.

I would appreciate it if someone could explain why the PlotStyle specification is not working as expected when the PlotLayout option is used. Am I missing something obvious here? Any insights or suggestions to resolve this issue would be greatly appreciated.

Thanks in advance for any help!

3 Replies

Your Length[data] is 63, each element being a list of two points in the plane. ListPlot gives you a row of 63 plots, each with two points.

POSTED BY: Gianluca Gorni

Sorry, I made a mistake when copying the code example. I have edited it.

The same happens for Plot:

Plot[{x, 1 - x}, {x, 0, 1}, PlotStyle -> {Blue, Red},
 PlotLayout -> "Row"]
Plot[{x, 1 - x}, {x, 0, 1}, PlotStyle -> {{Blue}, {Red}},
 PlotLayout -> "Row"]
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

Group Abstract Group Abstract