0

I am trying to draw a simple ellipse using gnuplot, but everywhere I read, one need data points to plot the ellipse.

Is there a comand in gnuplot where an ellipse is drawn simply by inputting semi major, semi minor, center of ellipse, and angle?

something like an one liner.

infoclogged
  • 3,641
  • 5
  • 32
  • 53

4 Answers4

1

This can be easily done in parametric mode:

a = 5.
b = 2.
set parametric
plot [0:2*pi] a*cos(t), b*sin(t)

enter image description here

user8153
  • 4,049
  • 1
  • 9
  • 18
1

This did the job

center is center; size is major, minor and angle is angle..

set object 1 ellipse center 1.5, 1  size 6, 12  angle 60 front fs empty bo 3
plot '-' with points

Of course, one needs to do the usual task, such as setting the ranges, terminal etc. beforehand.

OlivierBlanvillain
  • 7,701
  • 4
  • 32
  • 51
infoclogged
  • 3,641
  • 5
  • 32
  • 53
0

If you're using gnuplot from a bash shell you can do:

plot "<( echo x y a b angle )" w ellipses

Example:

plot "<( echo 0 0 2 1 45 )" w ellipses
0

Just for the records, in addition to @emmanuel's answer which uses a system call and works for gnuplot>=5.0.

Here is a solution without system call which works also for gnuplot>=4.6.0 (March 2012). The special filename '+' is used. The option every ::::0 is used to plot only a single ellipse.

plot '+' u (0):(0):(2):(1):(45) every ::::0 w ellipses

If you need to plot multiple different ellipses you can put your parameters into a file or datablock.

enter image description here

theozh
  • 22,244
  • 5
  • 28
  • 72