I'd like to print a plot with y-error-bars and just plain points. My current Octave script looks like this:
errorbar(x_list, y_list, Delta_y_list, "~.x");
title("physikalisches Pendel");
xlabel("a^2 [m^2]");
ylabel("aT^2 [ms^2]");
print -dpdf plot.pdf
The plot I get has a line, although I specified the .x style option:
http://wstaw.org/m/2012/04/14/umbrella5.png
How can I get rid of that line?
And the ylabel is in the scale as well, is there some way to fix that?
One has to set the linestyle:
p1 = errorbar(plot_x, plot_y, plot_error, "~.k");
set(p1, "linestyle", "none");
set(p1, "marker", "+");
Related
Goal: have two H6() on the same line.
I know to do this by having one Row() and two Col(). I am struggling to implement it ;(
Attempts:
...
# H6('Line markers'),
# H6('Line colors'),
# H6('Line markers', 'Line colors')
Row(Col(Div([H6('Line markers')]))),
Row(Col(Div([H6('Line colors')]))),
#Row(Col(Div([H6('Line markers'), H6('Line colors')]))),
...
Webpage:
Line markers
Line colors
Desired Webpage:
Line markers Line colors
No error in runtime but just aesthetically annoying.
You can do this with flex box. Wrap both in a div with style=dict(display='flex').
...
Row([Col(Div([H6('Line markers')])),
Col(Div([H6('Line colors')]))]),
...
I'm trying to plot the same shape from the 15 min onto the Daily as well. This is the code to plot a shape on the 15 min which works fine;
if crossover(s3K,s3D) and s3K<25 and (s4K-s4D<3 and s4K-s4D>-3) and s4K<35//or s4D-s4K>0 and s4D-s4K<1 and s4K<50 and s1K<40
rwCross:=true
plotshape(rwCross, style = shape.arrowup, location = location.belowbar, color=color.yellow, size=size.small)
But to plot it on the daily i've tried;
rwCrossDaily = security(syminfo.tickerid,'D', rwCross)
plotshape(rwCrossDaily, style = shape.arrowup, location = location.belowbar, color=color.yellow, size=size.small)
Which gives me the mutable variable error. So i tried using a function to get around it;
rwCross_func() =>
if crossover(s3K,s3D) and s3K<25 and (s4K-s4D<3 and s4K-s4D>-3) and s4K<35//or s4D-s4K>0 and s4D-s4K<1 and s4K<50 and s1K<40
rwCross:=true
rwCrossDaily = security(syminfo.tickerid,'D', rwCross_func())
But now it tells me I 'Cannot modify global variable 'rwCross' in function.'
Help please!
Best solution and cleanest solution here is to just make a bool out of your condition in its simplest form:
rwCross = crossover(s3K,s3D) and s3K<25 and (s4K-s4D<3 and s4K-s4D>-3) and s4K<35//or s4D-s4K>0 and s4D-s4K<1 and s4K<50 and s1K<40
rwCross will naturally become true without the if. This way we do not need to have anything mutable, although there are more solutions for situations that we must...
Cheers!
I'm trying to figure out how to add line spacing without adding spacing above the very first line of textflow.
This code:
$text = 'For more information about the Giant Wing Paper Plane see ' .
'our Web site <underline=true>www.kraxi-systems.com' .
'the Giant Wing in a thunderstorm as soon as possible.';
$optlist = 'fontname=Helvetica fontsize=12 encoding=unicode leading=400%';
$tf = $p->create_textflow($text, $optlist);
$result = $p->fit_textflow($tf, 28.346, 28.346, 400, 700, 'fitmethod=nofit');
$p->delete_textflow($tf);
results in:
All is good.
Next, I'm increasing the leading option to 400% as:
$optlist = 'fontname=Helvetica fontsize=12 encoding=unicode leading=400%';
And that gives me this:
Question:
How do I keep first paragraph line at the original position and only increase line spacing AFTER it?
checkout the "firstlinedist" option. The default is leading, but you might set this to "ascender" or "capheigt" or any other value.
Please see PDFlib 9.2 API reference, chapter 5.2, table 5.12 for more details.
I am facing an issue in Octave. When I set custom tick labels of y axis, labels are not updated correctly when zoomed. It is easy to solve in Matlab:
plot(1:10);
ax = gca;
ax.YAxis.TickLabelFormat = '%,.1f';
My code with faulty y labels when zoomed:
ax2 = gca;
ytick = get (ax2, "ytick");
yticklabel = strsplit (sprintf ("%9.0f\n", ytick), "\n", true);
set (ax2, "yticklabel", yticklabel);
The above code formats y tick labels properly, but labels does not match plot when zoomed. There is a screenshot of my issue: nonzoomed vs zoomed.
I am using W10 64bit, Octave version 4.0.3.. Octave was configured for "i686-w64-mingw32".
Any ideas?
I have decided to add minimal code example to be more clear about the issue:
x=1:length(inv);
figure
hax1 = subplot(2,1,1);
stairs(x,inv);
hax2 = subplot(2,1,2);
x=1:length(mon);
% big numbers here, need to format to get rid of scientific notation
stairs(x,mon);
ax2 = gca;
ytick = get (ax2, "ytick");
yticklabel = strsplit (sprintf ("%9.0f\n", ytick), "\n", true);
set (ax2, "yticklabel", yticklabel);
linkaxes([hax1 hax2],'x');
I have lots of series to draw in 1 plot. I want to decide the plot style/type according to the number of a series. Here is the example code of what I am aiming for:
title(i)=value(sprintf("title%i",i))
title1='x'
title2='x^2'
title3='x^3'
...
with(i)=value(sprintf("with%i",i))
with1='lines'
with2='points'
with3='boxes'
...
plot for [i=1:100] '-' title title(i) with with(i)
I have test the title() function works. But the with function does not work correctly.
Can you help me fix the code?
Or do you think there are other ways to achieve what I am aiming for?
It's possible to build a string of a plot command and then run this string:
p="plot x linewidth 1"
do for [i=1:10]{
p=p.sprintf(", x+%d linewidth %d", i, i+1)
}
print p
eval(p)
The output of the print command is:
plot x linewidth 1, x+1 linewidth 2, x+2 linewidth 3, ...
and this is the resulting plot:
Depending on what you finally want, this might be something for you:
do for [i=1:10]{
p=p.(i==1 ? "'myData.csv' with lines" : "")
p=p.(i==2 ? "'myData.csv' with steps" : "")
...
}
However, this looks pretty ugly.