The code plot([x,x^2],-.2,2) is a nice shortcut for plotting both x and x!^ 2 on the same graph. However, if you want to choose different colors or linestyles for each function, then it seems you have to execute, e.g.,
p1=plot(x,-.2,1.2,color='blue',linestyle='dotted');
p2=plot(x^2,-.2,1.2,color='red',linestyle='dashed');
p1+p2
Here is how Maple and Mathematica handle this issue, respectively:
It seems that the keyword 'fill' allows for a dictionary input, so perhaps the relevant code there could serve as a template?
[> plot([x, x^2], x= -.2..1.2, color=["blue", "red"],linestyle=[dot, longdash]);
In[1]:= Plot[{x, x^2}, {x, -.2, 1.2}, PlotStyle -> {{Blue, Dotted}, {Red, Dashed}}]
Remarks:
- distinct choices for the curves should be made automatically for the user. Running, e.g.,
In[1]:= Plot[{x, x^2}, {x, -.2, 1.2}]
in Mathematica produces two curves that are not both solid-blue.
- the functionality for
fillcolor, color, and fill should be the same insofar as possible.
CC: @kcrisman @ppurka @jdemeyer @jasongrout @saliola @sagetrac-jhonrubia6 @paulmasson @novoselt
Component: user interface
Keywords: plot, linestyle, color
Author: Aaron Lauve
Branch/Commit: 4acb9d6
Reviewer: Paul Masson
Issue created by migration from https://trac.sagemath.org/ticket/12962
The code
plot([x,x^2],-.2,2)is a nice shortcut for plotting both x and x!^ 2 on the same graph. However, if you want to choose different colors or linestyles for each function, then it seems you have to execute, e.g.,Here is how Maple and Mathematica handle this issue, respectively:
It seems that the keyword 'fill' allows for a dictionary input, so perhaps the relevant code there could serve as a template?
Remarks:
in Mathematica produces two curves that are not both solid-blue.
fillcolor,color, andfillshould be the same insofar as possible.CC: @kcrisman @ppurka @jdemeyer @jasongrout @saliola @sagetrac-jhonrubia6 @paulmasson @novoselt
Component: user interface
Keywords: plot, linestyle, color
Author: Aaron Lauve
Branch/Commit:
4acb9d6Reviewer: Paul Masson
Issue created by migration from https://trac.sagemath.org/ticket/12962