Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

my phd was a loooong gnuplot script

and here is the time-honored japhy - my first one!

use GD::Simple; use Chart::Gnuplot; my $image = GD::Simple->new(400, 40); $image->trueColor(1); $image->bgcolor('white'); $image->fgcolor('black'); $image->font('courier'); $image->fontsize(20); $image->moveTo(1,21); #$image->string("Just Another Perl Hacker"); $image->string("just another perl hacker"); my $W = $image->width(); my $H = $image->height(); my ($x, $y, $r, @onX, @onY); for ($x=0; $x<$image->width(); $x++) { for ($y=0; $y<$image->height(); + $y++) { $r = $image->getPixel($x,$y); if( $r > 0 ){ push @onY, $x; push @onX, $y; } }} my $dataSet = Chart::Gnuplot::DataSet->new( xdata => \@onX, ydata => \@onY, title => undef, style => "dots", ); # Create chart object and specify the properties of the chart my $chart = Chart::Gnuplot->new( title => undef, xlabel => undef, ylabel => undef, terminal => 'dumb size 40,180', ); # Plot the data set on the chart $chart->plot2d($dataSet);
400 +-----------------------------+ | + + + | | | | | | | | | | | | . . | | .. . . | | .. . . | | .. . . . | | .. .. .. .. .. . | | .. . . | | . . . | | | | . .. .. .. . | | .. . .. . . | | .. .. . . | | .. .. . . | | .. .. .. .. .. | | .. .. .. . | | | 350 |-+ .. . . +-| | .. . . .. . | | .. .. . .. .. . | | .. .. . | | .. .. .. .. .. .. .. . | | . . . | | | | .. .. . .. | | .. . .. . | | .. . . | | .. . . | | .. .. .. .. .. . | | . .. .. | | | | . . | | .. .. .. .. .. . | | .. .. .. . | | .. .. . . | | .. .. .. .. . | | . .. .. | | | | . . | 300 |-+ .. .. .. .. .. . +-| | .. . | | .. . . | | .. .. .. .. .. .. .. . | | .. .. .. .. .. .. .. . | | | | | | | | | | | | | | | | | | . . | | . . | | .. .. .. .. .. .. .. . | | .. .. .. .. .. .. .. . | | . . . | | . . . | | | | .. . | | .. . . | 250 |-+ .. . . . +-| | .. .. .. .. .. . | | .. .. .. .. .. . | | .. . . | | | | . .. .. | | . .. .. .. . | | .. . .. . . | | .. .. . . | | .. . .. .. . | | . .. .. .. .. | | .. . | | .. .. .. . | | .. .. . .. . | | .. . . | | .. . . .| | .. .. . .. .. . .| | .. .. .. .. .. .. .. .| | .. .| | | | | | | 200 |-+ +-| | | | | | | | .. . | | .. . . | | .. . . . | | .. .. .. .. .. . | | .. .. .. .. .. . | | .. . . | | | | . .. .. | | . .. .. .. . | | .. . .. . . | | .. .. . . | | .. . .. .. . | | . .. .. .. .. | | .. . | | . . | | .. .. .. .. .. . | | .. . . . | | .. | 150 |-.. .. .. .. .. .. .. . +-| | .. .. .. .. .. .. .. . | | . . . | | | | .. .. . | | .. . . | | .. . . | | .. .. .. .. .. .. .. . | | .. .. .. .. .. .. . | | .. | | . | | . .. .. .. .. | | .. . .. . | | .. . . | | .. . .. . | | . .. .. .. .. | | . | | . . | | .. .. .. .. .. . | | .. . . . | | .. | | .. . . . | 100 |-+ .. .. .. .. .. . +-| | .. . . | | . . | | .. .. .. .. . | | .. .. .. .. .. . | | .. .. . . | | .. .. . . | | .. .. .. .. . | | . . | | | | | | | | | | | | | | | | | | .. . | | .. . . | | .. . . | | . .. .. .. .. .. .. . | | .. .. .. .. .. .. .. | 50 |-+ .. +-| | | | .. .. . .. .. | | .. .. .. .. .. . | | .. .. . . | | .. . .. . . | | .. .. . . .. . | | . .. . | | . . | | .. .. .. .. .. . | | .. .. .. .. .. . | | .. . .. | | . . | | .. .. .. .. .. . | | .. | | | | .. .. .. .. .. .. . | | .. .. .. .. .. .. .. .. .| | .. .. .| | .. .| | .. .| | + + + | 0 +-----------------------------+ 5 10 15 20 25

bw, bliako


In reply to Re^3: Plaintext plot - existing sofware? by bliako
in thread Plaintext plot - existing sofware? by parv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2022-05-22 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?