Mathematica : Draw a simple line, make into image

  • Mathematica
  • Thread starter Hepth
  • Start date
  • #1
Hepth
Gold Member
448
39

Main Question or Discussion Point

I wish to create, in Mathematica, an image.

I have a set of lines, for the sake of a test, lets use:

{{10,0},{40,100}}
{{20,0},{80,100}}

Now I want my image to be 400x100 pixels, and the lines to appear as if their coordinates are those of the points in the image. If I do:

Graphics[Line[{{{10, 0}, {40, 100}}, {{20, 0}, {80, 100}}}],
ImageSize -> {400, 100}, AlignmentPoint -> {Left, Bottom}]

It doesnt work. Any help? The lines should be on the left side of the picture.
 

Answers and Replies

  • #2
1,069
29
Wrap a Show[] around your Graphics[]

In[1]:= Show[Graphics[Line[{{{10, 0}, {40, 100}}, {{20, 0}, {80, 100}}}], ImageSize -> {400, 100}, AlignmentPoint -> {Left, Bottom}]]

Out[1]= ...ImageSnipped...

But this doesn't address your "The lines should be on the left side of the picture."

Maybe what you want is to specify the PlotRange option, something like this

In[2]:= Show[Graphics[Line[{{{10, 0}, {40, 100}}, {{20, 0}, {80, 100}}}], ImageSize -> {400, 100}, AlignmentPoint -> {Left, Bottom}], PlotRange -> {{0, 400}, {0, 100}}]

Out[2]= ...ImageSnipped...

But there are lots of options you may need to explore to get a graphic to be just the way you want.
 
  • #3
Hepth
Gold Member
448
39
PlotRange worked! Thanks a million. Now to post another question....
 

Related Threads on Mathematica : Draw a simple line, make into image

Replies
0
Views
2K
Replies
2
Views
4K
Replies
4
Views
3K
Replies
3
Views
9K
Replies
1
Views
2K
Replies
5
Views
4K
Replies
2
Views
16K
Replies
2
Views
2K
Replies
6
Views
4K
Top