many graphs with different styles (colors etc)

pfb shared this question 2 years ago
Answered

Hi,

I need to draw many graphs with different styles (e.g. line colors).

I know how to draw all the graphs at once with the Sequence command, but in that case all the curves have the same color.

Can this be done via geogebra script or javascript?

A different option I explored is to use inequalities, which produce shaded areas. Many overlapping areas will produce a sort of gradient, which I would be happy with.

For instance

x> 2x, x>2x+1, x>2x+2, x>2x + 3

This works ok when I input the inequalities individually. However, I do not seem to be able to get the syntax right for a sequence of inequalities (assuming that it is even possible).

Thanks for all the insight you can give

Francesco

Comments (5)

photo
1

Try

Sequence(y>2x+j,j,1,10)

photo
1

Hi Michael,

thank you very much, this does work.

However, I would like to limit this to x>0. I tried

If(x>0, y>2x+1)

and it does not produce anything (alone or in a sequence). Instead

Sequence(x>0,y<2x+j,j,1,10)

does work, but then I need to set the linewidth to 0 (because the lines are all over the place) and use a new sequence to draw the lines, if needed.


Anyway thanks again.

I think I was not able to get anything because the first thing I tried was

Sequence(If(x>0,y>2x+i),i,1,10)

photo
1

Sequence(y>2x+j && x>0,j,1,10)

photo
photo
1

create in spreadsheet


open the attached

see the advance color of B1


search your custom formula for colouring

select B1

drag down the little blue square in selection rectangle

Files: foro.ggb
photo
1

Hi mathmagic

this is cool. I could also use 3 columns in the spreadsheet for a colormap.

Thanks a lot!

© 2022 International GeoGebra Institute