Julia version: 1.4.1
Kubuntu: 18.04 LTS
As a french-speaking person, I often use accentuated characters e.g., é (e-accute). When I run a simple code like this one:
t(x) = cos(x)
u(x) = -sin(x)
linewidth = 2.0,
framestyle = :box, grid = :yes,
title="cos(x) et sa dérivée",
I obtain an error and in the graph, each é is replaced by an empty rectangle:
GKS: character ignored due to unicode error
In the same vein, greek letters are replace by ?
Do you know how to circumvent this(these) problem(s) by using Plots?
Thank you in advance,
Perhaps this is solved, https://github.com/jheinen/GR.jl/issues/143 suggests that you can enable unicode like so:
Thank you very much, macabbott. This works fine.
As suggested in the link you sent me, I inserted
In the same simple code as described above, how can I obtain -π, -π/2, etc., on the X-axis instead of -3.14, -1.57, etc?
And how to represent for example units in the form of ms-² instead of ms^-2 on a given axis typically?
One way to give labels for ticks is like so:
plot(rand(5), xaxis=("ex", (0,7), ([1,2,3,4], ["one", "II", "3/\\(1\\)", "\\ 4^(1)"]) )). GR has a mode in which it displays fractions & exponents, which I though giving
\\alpha etc. would activate, but a quoted space like
\\ seems to work too… perhaps there is a more official way.
Thank you very much macabbott.
I am working on your solution in order to adapt it.
However I though that:
I tried your command and it works. Many thanks.
However, I turned towards GnuPlot and its Julia interface, i.e., Gaston in order to use “gpcom” commands of GnuPlot which make the code easy to read (IMHO). Here is an example of a very elementary code which works even though I am sure that it is not very instructive for Julia geeks as you. [The xlabel is just for fun (a trial to obtain upperscript in units)]. More interesting is the fact that this code is much more rapid (~10 times) than its Plots equivalent.
t = 0.0:0.01:2π
keyoptions="box top right",
gpcom="set xtics pi; set format x '%.0Pπ'" # GnuPlot command
printfigure(term="png", font="Times,16", size="1000,650",
I’ve started getting this error when generating plots where tick mark labels are of the form
3X10^4 : the X doesn’t appear and the labels are distorted as shown in the attached figure. This must be associated with some recent change, I think, since I didn’t used to have the problem. I have inserted
ENV["GKS_ENCODING"]="utf-8" before plotting, but that doesn’t fix the error.
Is ENV[“GKS_ENCODING”]=“utf-8” inserted in startup.jl?
What is your julia version?
Are you dealing with using Plots?
I put this right before generating the plots not in startup.jl (yes, with the Plots package.
This is with Julia 1.4.1 ; I ran update in pkg mode a few days ago so Plots should be current - in fact it was after updating that the problem started
Maybe a problem of fonts?
Is there an easy way to specify a font family?
Again this is weird (To me) because it is a new problem.