ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 20 Sep 2021 00:31:45 +0200Marker color not consistenthttps://ask.sagemath.org/question/59101/marker-color-not-consistent/I have a simple plot with a legend in different colors. The result will be correct or incorrect depending of the order of the graphic elements.
This code gives an incorrect result:
reset()
Plaut = Graphics()
Plaut+=point([1,1/2],color='blue',size=15,legend_label='Sample point', legend_color='blue')
Plaut+=plot(x/2,x,0,2,color='black', thickness=0.2,legend_label='black line', legend_color='black')
Plaut+=plot(-x/2+1,x,0,2,color='red', thickness=0.2,legend_label='red line', legend_color='red')
Plaut.set_legend_options(loc=(1.1,0), markerscale=1)
show(Plaut, title='Color of the marker - 1.')
see ![Marker Color 1](/upfiles/16320897431508949.png)
while this one (the only difference with the first one being the order of the graphic elements) gives a correct result:
reset()
Plaut = Graphics()
Plaut+=plot(x/2,x,0,2,color='black', thickness=0.2,legend_label='black line', legend_color='black')
Plaut+=plot(-x/2+1,x,0,2,color='red', thickness=0.2,legend_label='red line', legend_color='red')
Plaut+=point([1,1/2],color='blue',size=15,legend_label='Sample point', legend_color='blue')
Plaut.set_legend_options(loc=(1.1,0), markerscale=1)
show(Plaut, title='Color of the marker - 2.')
Here, the result is as expected:
![image description](/upfiles/16320900833480936.png)
For this MWE the correction was easy but when I have a lot of elements it is time consuming and somewhat frustrating to manually find the right configuration. I did not find in the manual a rule to follow to directly get the correct result.c05772Mon, 20 Sep 2021 00:31:45 +0200https://ask.sagemath.org/question/59101/Assign RGB values to points on implicit_plot3d graphhttps://ask.sagemath.org/question/56955/assign-rgb-values-to-points-on-implicit_plot3d-graph/Is there a way to assign an explicit RGB color to each point satisfying an equation of the form f(x,y,z)=c? For instance, I would like it if the command
```
implicit_plot3d(x+y+z==1,(x,0,1),(y,0,1),(z,0,1),color=(x,y,z))
```
colored the standard 2-simplex in R^3 according to the associated RGB values, but it doesn't. I'm aware that one can use colormaps and functions R^3 -> R to color the output of implicit_plot3d but I would like to use a function R^3 -> [0,1]^3 to do the coloring.kyle oTue, 04 May 2021 21:17:37 +0200https://ask.sagemath.org/question/56955/Updating graph plothttps://ask.sagemath.org/question/36342/updating-graph-plot/I wish to visualize a algorithm running on a graph. How can I update the plot of a graph after for example deleting a vertex or to change color of a vertex without generating another plot window?AckslThu, 19 Jan 2017 09:29:05 +0100https://ask.sagemath.org/question/36342/plot point color changehttps://ask.sagemath.org/question/36295/plot-point-color-change/How do change the plot point color so that I can tell the difference between my three different equations?
Here is what I have so far:
S = []
I = []
R = []
S.append(100000)
I.append(100)
R.append(0)
beta = 100
gamma = .4
lamda = 5e-006
mu = .001
i = 0
while(i<100):
R.append(R[i] + (-mu * R[i] + gamma * I[i]))
I.append(I[i] + (-mu * I[i] + lamda * S[i] * I[i] - gamma * I[i]))
S.append(S[i] + (beta - mu * S[i] - lamda * S[i] * I[i]))
i = i+1
N=range(1,100)
A = S
AN=zip(N,A)
B = I
BN=zip(N,B)
C = R
RN = zip(N,R)
plot(point(BN), legend_label = 'S(t)', color = 'green')kaylavb23Sun, 15 Jan 2017 03:44:20 +0100https://ask.sagemath.org/question/36295/Plotting a 2d functionhttps://ask.sagemath.org/question/25122/plotting-a-2d-function/This should be easy, I want to make a nice colour plot of a 2d function where colour denotes the function value.
I can do
> y=var('y')
> f=y^2
> plot(f)
and I get a nice plot.
If I try
> y=var('y')
> f=y^2+x^2
> plot(f)
Then sage tells me it can't find the variable y. Which is ridiculous, since y is in the same place as when I tried to plot a 1d function of y. Anyway, I tried googling to find a function within sage to achieve this (without resorting to excessive matplotlib syntax) and had no success so thought I'd ask a question here. Intuitively, the second case is hardly more complicated than the former so there should be a simple function that can realize this for me.
Many thanks!DarwinThu, 04 Dec 2014 17:53:03 +0100https://ask.sagemath.org/question/25122/