Giter Site home page Giter Site logo

Comments (11)

benschneider avatar benschneider commented on May 23, 2024

yeah I think python interprets those special characters, so you need to escape the escape characters :).
try : "\\n" instead of "\n"

from pygnuplot.

dreamonhigh avatar dreamonhigh commented on May 23, 2024

thanks .. but still no luck
using \n it prints → 06.12.\n12

using one single \n it result an error.

full command: gp.c("set xtics format '%d.%m\n%HUhr' textcolor 'black'")
one more idea?

from pygnuplot.

benschneider avatar benschneider commented on May 23, 2024

does this one work: gp.c(r"set xtics format '%d.%m\n%HUhr' textcolor 'black'")
?

from pygnuplot.

dreamonhigh avatar dreamonhigh commented on May 23, 2024

still no luck :(
it through no error. but still no linefeed at this point.

from pygnuplot.

dreamonhigh avatar dreamonhigh commented on May 23, 2024

It prints "06.12\n12" as label, no linefeed but \n is printed instead

from pygnuplot.

dreamonhigh avatar dreamonhigh commented on May 23, 2024

no more idea?

from pygnuplot.

benschneider avatar benschneider commented on May 23, 2024

For the meantime, you could once type them in in gnuplot then use : save 'myfile.gn'.
open "myfile.gn" edit / shorten it to your needs and load that one when needed.

can you please tell me the full command string that you are trying to generate and pass from python to gnuplot?
i.e. example code ?

from pygnuplot.

benschneider avatar benschneider commented on May 23, 2024

It might be good to "prepare" the '%d.%m\n%h' string beforehand, i.e. store it in a separate variable, so you can check if python is parsing it right.

from pygnuplot.

dreamonhigh avatar dreamonhigh commented on May 23, 2024

sorry. tried a lot of things without luck. here is a easy example.
linefeed is ignored or \n is printed but not done.
example makes no sense, but I'm only interested in \n to linefeed.

import PyGnuplot as gp
gp.c("set title 'XXXXXXXXXXXXXXXXXXXXXXX")
gp.c(r"set xtics format 'Line1\nLine2' textcolor 'black'")
gp.c("plot [-10:10] sin(x),atan(x),cos(atan(x))")

from pygnuplot.

benschneider avatar benschneider commented on May 23, 2024

Just running this directly in gnuplot gives me the exact same results as run via PyGnuplot.

So I tried changing the command itself until I got a new line working:

set xtics format "Line1\nLine2" textcolor "black"

turns out gnuplot requires " marks not ' marks ;).

so your command needs to be:

gp.c("set title 'XXXXXXXXXXXXXXXXXXXXXXX'")
gp.c(r'set xtics format "Line1\nLine2" textcolor "black"')
gp.c("plot [-10:10] sin(x),atan(x),cos(atan(x))")

from pygnuplot.

dreamonhigh avatar dreamonhigh commented on May 23, 2024

hello Ben.
Yes this works fine.
Thank you very much!

from pygnuplot.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.