How to set title for multiplot with a string generated by a function?
Sollovin opened this issue · 1 comments
Sollovin commented
Hi, I'm trying to generate a series of multiplot figures, whose title is determined by a function:
function plotname(x::Int)
return string("x-", x)
end
In gnuplot, the command to set a title for a multiplot is
set multiplot layout 1,2 title "YOUR_TITLE_HERE"
So what I'm trying to implement is a julia script like this
using Gnuplot
function plotname(x::Int)
return string("x-", x)
end
@gp "set multiplot layout 1,2 title 'plotname(33)'"
@gp :- 1 1:5 :-
@gp :- 2 2:6
to plot a multiplot with title "x-33", but it do not work.
Maybe there are some julia tricks could help? Any suggestion is appreciated.
Sollovin commented
I think I found a workround as follows
using Gnuplot
function plotname(x::Int)
return string("x-", x)
end
plottitle = plotname(33)
@gp "set multiplot layout 1,2 title '$plottitle'"
@gp :- 1 1:5 :-
@gp :- 2 2:6
# or
@gp "set multiplot layout 1,2 title '$(plotname(33))'"
@gp :- 1 1:5 :-
@gp :- 2 2:6