use perl to draw Venn Diagram

E

Ela

Perl has a GD library. But its circle, arc, line and alike seem to have
limited applications.

I just want to plot 2 circles, one with solid line and another with dotted
line, overlapping with each other according to an input overlapping
parameter (I guess this feature may be achieved by locating the 2 centers
accordingly). Finally write some texts in the centers of the 2 circles. Any
suggestions? Matlab can achieve that easily and is Perl really unable to do
that?
 
G

Gunnar Hjalmarsson

Ela said:
Perl has a GD library.

No. Perl has an interface to the GD Graphics Library.

http://search.cpan.org/perldoc?GD
But its circle, arc, line and alike seem to have limited applications.

How did you come to that conclusion?
I just want to plot 2 circles, one with solid line and another with dotted
line, overlapping with each other according to an input overlapping
parameter (I guess this feature may be achieved by locating the 2 centers
accordingly). Finally write some texts in the centers of the 2 circles.

Interesting. Have you written any code yet?
 
E

Ela

I just want to plot 2 circles, one with solid line and another with
Interesting. Have you written any code yet?

In Matlab, I can specify parameters like: LineWidth, LineStyle and so. I'm
not asking others to post their codes but would like to know whether such
parameters exist or not. Because after reading

Graphics_Programming_with_Perl by Martien_Verbruggen-Manning

I did not find any clues.
 
G

Gunnar Hjalmarsson

Ela said:
In Matlab, I can specify parameters like: LineWidth, LineStyle and so. I'm
not asking others to post their codes but would like to know whether such
parameters exist or not.

Then read the docs for GD.pm (link provided in my previous message).
Because after reading

Graphics_Programming_with_Perl by Martien_Verbruggen-Manning

I did not find any clues.

But you didn't read the GD.pm docs, right?
 
J

Joost Diepenmaat

Ela said:
In Matlab, I can specify parameters like: LineWidth, LineStyle and so. I'm
not asking others to post their codes but would like to know whether such
parameters exist or not. Because after reading

Graphics_Programming_with_Perl by Martien_Verbruggen-Manning

I did not find any clues.

GD can do that. Read its docs.

Personally, I prefer Cairo...
 
Z

zentara

Perl has a GD library. But its circle, arc, line and alike seem to have
limited applications.

I just want to plot 2 circles, one with solid line and another with dotted
line, overlapping with each other according to an input overlapping
parameter (I guess this feature may be achieved by locating the 2 centers
accordingly). Finally write some texts in the centers of the 2 circles. Any
suggestions? Matlab can achieve that easily and is Perl really unable to do
that?

Yeah, see my replies in http://perlmonks.org?node_id=502389 for ways to
do it with Tk, Gtk2, and Tk::Zinc.

Writing text is a simple addition. You can also save the Canvases if
desired to a pdf or jpg, etc, and you can add mouse-dragging if wanted.

zentara
 
E

Ela

Then read the docs for GD.pm (link provided in my previous message).
But you didn't read the GD.pm docs, right?

--
Thanks a lot, Gunnar Hjalmarsson. But the doc and google search don't tell
me how to use gdstyled and gdbrushed to draw a circle with a dashed/dotted
line.
 
E

Ela

Yeah, see my replies in http://perlmonks.org?node_id=502389 for ways to
do it with Tk, Gtk2, and Tk::Zinc.

Writing text is a simple addition. You can also save the Canvases if
desired to a pdf or jpg, etc, and you can add mouse-dragging if wanted.
Thanks, zentara. Instead of drawing a sophisticated Venn diagram like yours,
I just need simple ones. And the fatal error is that I can't install
X-related onto computer. Is there any workaround? I need to produce ~1000
Venn diagrams...
 
J

Joost Diepenmaat

Ela said:
Thanks a lot, Gunnar Hjalmarsson. But the doc and google search don't tell
me how to use gdstyled and gdbrushed to draw a circle with a dashed/dotted
line.

The following is copied directly from the getStyle section of the GD
docs at <http://search.cpan.org/~lds/GD-2.39/GD.pm>:

# Set a style consisting of 4 pixels of yellow,
# 4 pixels of blue, and a 2 pixel gap
$myImage->setStyle($yellow,$yellow,$yellow,$yellow,
$blue,$blue,$blue,$blue,
gdTransparent,gdTransparent);
$myImage->arc(50,50,25,25,0,360,gdStyled);

You could probably also use brushes instead. Anyway all the
information is really there in the docs. If you're unable to create a
working script from that, you may want to post at least what you've
got now and what you're having difficulty with *exactly*. Just
claiming GD doesn't do what you want when it clearly does and even
provide examples in the docs isn't helping.

Take some time to read the full manpage linked above, it's not that
big and you should be able to figure it out yourself.
 
E

Ela

You could probably also use brushes instead. Anyway all the
information is really there in the docs. If you're unable to create a
working script from that, you may want to post at least what you've
got now and what you're having difficulty with *exactly*. Just
claiming GD doesn't do what you want when it clearly does and even
provide examples in the docs isn't helping.

Take some time to read the full manpage linked above, it's not that
big and you should be able to figure it out yourself.
I feel sorry for not understanding what "holes" refer to... Not
complimenting Matlab, but I am used to its elegant library to provide
intuitive and powerful functions... Certainly, GD provides a greater control
over how wide the holes can be...
 
Z

zentara

I feel sorry for not understanding what "holes" refer to... Not
complimenting Matlab, but I am used to its elegant library to provide
intuitive and powerful functions... Certainly, GD provides a greater control
over how wide the holes can be...

If you need to do this without X, you might want to look at the Cairo
module
http://cairographics.org/samples/

You can save them to many file formats. Gtk2's graphics are based
on Cairo.

zentara
 
T

Ted Zlatanov

z> If you need to do this without X, you might want to look at the Cairo
z> module
z> http://cairographics.org/samples/

z> You can save them to many file formats. Gtk2's graphics are based
z> on Cairo.

Also the OP may want to consider Matlab's own scripting abilities which
are pretty decent.

Ted
 
N

nolo contendere

z> If you need to do this without X, you might want to look at the Cairo
z> module
z>http://cairographics.org/samples/

z> You can save them to many file formats. Gtk2's graphics are based
z> on Cairo.

Also the OP may want to consider Matlab's own scripting abilities which
are pretty decent.

Really? I have only cursory experience with Matlab, which was used in
a genomics course I took, but I wasn't very impressed. Guess I didn't
look closely enough at it.
 
T

Ted Zlatanov

nc> Really? I have only cursory experience with Matlab, which was used in
nc> a genomics course I took, but I wasn't very impressed. Guess I didn't
nc> look closely enough at it.

It's pretty decent for what it does. For example, you can easily loop
over N values and do a plot that depends on the current value, which is
what the OP wanted. There's nntp:comp.soft-sys.matlab too.

See:

http://www.math.ucdavis.edu/~sawilliams/MATLABguide.html
http://physics.gac.edu/~huber/envision/tutor2/mtlscrip.htm

.... and many other M-file examples Google returned, plus Mathworks' own site ...

Note I use "scripts" when I mean functions as well in the Matlab
context.

Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top