Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8271001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:44:09+00:00 2026-06-08T06:44:09+00:00

I’m trying to display a spectogram using JavaPlot with this piece of code: PlotStyle

  • 0

I’m trying to display a spectogram using JavaPlot with this piece of code:

    PlotStyle style = new PlotStyle();
    style.setStyle(Style.IMAGE);


    DataSetPlot data = new DataSetPlot(points);
    data.setPlotStyle(style);


    JavaPlot plot = new JavaPlot();
    plot.addPlot(data);
    plot.plot();

Where the points are valid as they work when using gnuplot in the command line like this:

 gnuplot --persist -e 'plot "data.dat" w image'

The problem is that the above piece of code doesn’t show any image at all, it is all white. However the previous command works fine, and data.dat contains the points in the exactly same format. No error appears when running the code.

Here is a example of some points data:

0.0 193.0 0.18183826861232413
0.0 194.0 0.2467637036800797
0.0 195.0 0.43531750893288235
0.0 196.0 0.3893599780473012
0.0 197.0 0.3220816458659573
0.0 198.0 0.25389713892289173
0.0 199.0 0.22935136709597423
1.0 0.0 0.23021155472288352
1.0 1.0 0.33383157107150707
1.0 2.0 0.3745792715533692
1.0 3.0 2.028348052193793
1.0 4.0 2.4150235476868978
1.0 5.0 2.4169194327766736
1.0 6.0 1.8633442057577019
1.0 7.0 4.2682342944471054
1.0 8.0 3.22544345282322

And this are the commands sended to gnuplot by JavaPlot:

set multiplot layout 1,2 rowsfirst downwards
_gnuplot_error = 1
plot '-' title 'Datafile 1' with image ; _gnuplot_error = 0
0.0 9.0 6.612583996900796 
1.0 9.0 4.719585678813712 
2.0 9.0 0.5475948495661151 
3.0 9.0 0.7385211622757041 
4.0 9.0 0.711512824841686 
5.0 9.0 3.7572382303712604 
6.0 9.0 1.0818137070547578 
7.0 9.0 0.057188125070687344 
8.0 9.0 0.8218555010675036 
9.0 9.0 5.754170136586405 
e
if (_gnuplot_error == 1) print '_ERROR_'
unset multiplot
quit

For this example I took 10×10 points, so the passed coordinates should be something like:

0.0 0.0 6.612583996900796 
0.0 1.0 4.719585678813712 
0.0 2.0 0.5475948495661151 
0.0 3.0 0.7385211622757041 
0.0 4.0 0.711512824841686 
0.0 5.0 3.7572382303712604 
0.0 6.0 1.0818137070547578 
0.0 7.0 0.057188125070687344 
0.0 8.0 0.8218555010675036 
0.0 9.0 5.754170136586405 
1.0 0.0 6.612583996900796 
1.0 1.0 4.719585678813712 
1.0 2.0 0.5475948495661151 
1.0 3.0 0.7385211622757041 
1.0 4.0 0.711512824841686 
1.0 5.0 3.7572382303712604 
1.0 6.0 1.0818137070547578 
1.0 7.0 0.057188125070687344 
1.0 8.0 0.8218555010675036 
1.0 9.0 5.754170136586405 
...
9.0 9.0 xxxxxxxxxxxxx

It seems that JavaPlot is not iterating the Y coordinates.

Does someone know what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:44:10+00:00Added an answer on June 8, 2026 at 6:44 am

    As I couldn’t fix that error I finally decided to call gnuplot and pass the points correctly by myself. Here is the piece of code I’ve used to draw the spectogram:

    Process p = Runtime.getRuntime().exec("gnuplot --persist");
    
    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
    String s = "plot '-' title 'Spectogram' w image\n";
    writer.write(s);
    writer.flush();
    
    for(int m = 0; m < x.length; m++){
       for(int k = 0; k < x[0].length; k++){
           s = m + " " + k + " " + x[m][k] + "\n";
           writer.write(s);  
           writer.flush();
       }
    }
    
    s = "e\n";
    writer.write(s);
    writer.flush();
    

    And it works! 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.