5

I'm trying to get a very simple plot by plotting:

  • y=3
  • y=2x
  • x=3

I have no problem to plot y=3 and y=2x

However, how do I plot x=3?

plot

I use this code:

usepackage("amsmath,amssymb"); usepackage("inputenc","utf8"); // code
figure import graph; unitsize(1cm,1cm); xlimits(0,10); ylimits(0,10);
real F(real x) {return 3;}
draw(graph(F,0,10,n=400),linewidth(1pt)+black+solid); real G(real x)
{return 2x;} draw(graph(G,0,10,n=400),linewidth(1pt)+black+solid);
xlimits(0,10,Crop); ylimits(0,10,Crop);

xaxis(axis=YEquals(0),xmin=0,xmax=10,Ticks(scale(.7)*Label(),beginlabel=true,endlabel=true,begin=true,end=true,Step=1,Size=1mm),p=linewidth(1pt)+black,Arrow(2mm),true);
yaxis(axis=XEquals(0),ymin=0,ymax=10,Ticks(scale(.7)*Label(),beginlabel=true,endlabel=true,begin=true,end=true,Step=1,Size=1mm),p=linewidth(1pt)+black,Arrow(2mm),true);
// code supplémentaire

shipout(bbox(0.1cm,0.1cm,white));

migrated from stackoverflow.com Jan 31 '13 at 23:11

This question came from our site for professional and enthusiast programmers.

1

Ok I find the solution:

draw((15,0)--(15,55),linewidth(1pt)+black+solid);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.