Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scale command breaks graph output #459

Closed
badkey opened this issue May 27, 2024 · 2 comments
Closed

scale command breaks graph output #459

badkey opened this issue May 27, 2024 · 2 comments

Comments

@badkey
Copy link

badkey commented May 27, 2024

Hi,
trying to plot a log-linear graph to a picture I ran into this problem:

import graph;

// some function
real f(real t) {return 1/t;}

picture s;
size(s, 200,200,IgnoreAspect);
//scale(s, Log, Linear);
draw(s, graph(f,1,10000), blue);
xaxis(s, "$x$",BottomTop,LeftTicks);
yaxis(s, "$y$",LeftRight,RightTicks);
add(s.fit());

does nicely work unless one uncomments the scale command. The same does work when working without a picture (e.g. using currentpicture). Any hint is appreciated.
Jan-Mark

@johncbowman
Copy link
Member

johncbowman commented May 27, 2024

You simply forgot the s argument to graph:

import graph;

// some function
real f(real t) {return 1/t;}

picture s;
size(s, 200,200,IgnoreAspect);
scale(s, Log, Linear);
draw(s, graph(s,f,1,10000), blue);
xaxis(s, "$x$",BottomTop,LeftTicks);
yaxis(s, "$y$",LeftRight,RightTicks);
add(s.fit());

@badkey
Copy link
Author

badkey commented May 28, 2024

Thanks a lot - I have overseen this one. And also Scale() needs the s as I noticed right now...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants