Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hey Monks, Thank to the help of some monks below, I was able to scale the heatmaps using cbrange. My issue now is with using TK to make it interactive. I was able to use this post http://www.perlmonks.org/?node_id=685864 to a certain extent to get what I want. When I hit the plot button, I get the contour plot in a new window. The Plot button is still pressed. I can close the contour plot window, but the plot button in the TK window is still pressed and my perl interface starts to hang. I cannot even hit the exit button on the Tk window. How can I "unrelease" the plot button so that every time I click it, I get a new contour plot window (replacing the old one). Thanks monks!
my $chart = Chart::Gnuplot->new( terminal => 'windows', title => "3D plot from arrays of x, y and z coordinates", xlabel => 'x', ylabel => 'y', ); #my $x = 110; #my $y = 130; $chart->set(pm3d => 'map'); $chart->set(palette => 'defined (0 0 0 1, 1 1 1 0, 2 1 0 0)'); $chart->set(dgrid3d => '385,385'); $chart->set(cbrange => "[$x:$y]"); my $dataSet = Chart::Gnuplot::DataSet->new( points => \@array, ); my $mw = new MainWindow; my $frame = $mw->Frame->pack( -anchor => 'w' ); $frame->Button(-text => "Exit", -command => sub{&quit, $mw->destroy; })->pack(-side => "bo +ttom"); my $plotbutton = $frame->Button( -text => 'Plot', -command => \&plot, )->pack( -side => "bottom"); $mw->protocol( 'WM_DELETE_WINDOW', \&quit ); $mw->bind( "<Return>", sub { $plotbutton->invoke } ); MainLoop; sub plot { $chart->plot3d($dataSet); } sub quit { $chart->close; $mw->destroy; }

In reply to Integrating TK and Chart::Gnuplot. by Ppeoc

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 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?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2024-04-23 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found