Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: GNUplot shows nothing in web page

  1. #1
    Join Date
    Sep 2013
    Beans
    9

    GNUplot shows nothing in web page

    Hi,

    I am a newbie to GNUplot. I wrote a script that creates gnuplot graph and store that as html. When I run the script it creats the html page. It works well when I give the location of the html page in the browser "var/www/html/gnuplot.html". But when I call the same html page using the address, "localhost/gnuplot.html" I don't see the graph. When I double click the html page I see the graph. Only when I use the address as "localhost/gnuplot.html", I don't see the graph. Could you please help me solve this issue?

  2. #2
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: GNUplot shows nothing in web page

    What are the permissions of the file?

    Code:
    ls -la /var/www/html/gnu*
    It should be www-data:www-data, otherwise apache2 won't serve it.

    Also, http://localhost/html/gnuplot.html might work.

    If /var/www/html is indeed your root webserver directory, than you need to change the default in the apache configuration file. /var/www is the default, not /var/www/html.
    Last edited by tgalati4; September 13th, 2013 at 10:11 PM.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  3. #3
    Join Date
    Sep 2013
    Beans
    9

    Re: GNUplot shows nothing in web page

    Thanks for your reply. I changed the user and group to apache as I am using apache server. My problem is I can open a gif file or other file format without any issues. Only when I try to open gnuplot file as html, I get this issue. When I save gnuplot as gif file and open it, it opens fine. Could you please tell me howto call a gnuplot html page from a php?
    Last edited by GNUNewbie; September 16th, 2013 at 08:39 PM.

  4. #4
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: GNUplot shows nothing in web page

    Why don't you post what is in gnuplot.html? Perhaps it is a malformed file, so apache doesn't know what to do with it.

    Not sure what your PHP code looks like, but have you gone through the PHP documentation for external program execution? http://php5.org/ref.exec.php
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  5. #5
    Join Date
    Sep 2013
    Beans
    9

    Re: GNUplot shows nothing in web page

    I wrote a script that creates GNUplot graph and saves it as gnuplot.html. Here is the script.


    #!/bin/sh

    echo "set term canvas mousing size 500, 500
    set xlabel 'Feeder'
    set ylabel 'Error count'
    set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb'grey' behind
    set output 'gnuplot.html'
    plot 'sample.txt' title 'Feeder-Error graph' with linespoints" | gnuplot

    So gnuplot.html file just contains the graph.
    Last edited by GNUNewbie; September 17th, 2013 at 02:01 PM.

  6. #6
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: GNUplot shows nothing in web page

    If the file has an .html extension, browsers and the OS will assume it's written in HTML. Why not save it as a graphic like .png? This posting has some help on getting good PNG results. PDF might be a better choice, too.

    There are some PHP interfaces to run GNUplot like http://sourceforge.net/projects/php-gnuplot/.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: GNUplot shows nothing in web page

    That was my point. You need a properly-formatted html file with an html descriptor, headers, body, etc for a browser to view it. The package that SeijiSensei suggests might do that.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  8. #8
    Join Date
    Sep 2013
    Beans
    9

    Re: GNUplot shows nothing in web page

    Thanks for your response. I tried to save it as png and it works. With html format, I use canvas attribute and it looks more interactive than png. When I just double click to open gnuplot.html file as such, there is no problem. I can view it in the browser. Only when I use localhost to view the html file, I get this probelm.

  9. #9
    Join Date
    Feb 2007
    Location
    West Hills CA
    Beans
    10,044
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: GNUplot shows nothing in web page

    Look in /var/log/apache for apache errors as to why it won't open with localhost. There may be a subtle permissions problem with localhost. Try using the actual IP address instead and see if that works. If that is the case, then you would need to put the server hostname in /etc/hosts.
    -------------------------------------
    Oooh Shiny: PopularPages

    Unumquodque potest reparantur. Patientia sit virtus.

  10. #10
    Join Date
    Sep 2013
    Beans
    9

    Re: GNUplot shows nothing in web page

    Thanks for your response. I don't think there is permission porblem with localhost. I am able to open other html/php files in localhost without any problem. Only the file with gnuplot , I am not able to open.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •