[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: histogram with logscale ...
From: |
Pantxo |
Subject: |
Re: histogram with logscale ... |
Date: |
Thu, 30 Nov 2017 05:53:08 -0700 (MST) |
address@hidden wrote
> Dear listmembers,
> 1.) trying to achieve a logscaling on the y-axis of a plot using "hist"
> gives me the result as attached in "Screenshot_histogram_logscale.jpg".
> The only difference between both commands consists of the additional
> setting
>
> set (gca,'yscale', 'log');
>
> Could some kind soul suggest a way how to get the same coloured bargraphs
> as in the linear y-axis case?
>
> 2.) Is there any means to dump the gnuplot-parameter data that are piped
> to gnuplot into a file? I tried the "rough" way by renaming the
> corresponding binary and writing stdout from octave into a file, however,
> this did not yield the expected results. The reason for this: I need
> modifications to the graph, straightforward achievable through gnuplot
> directly, impossble (much effort at least ....) through octave.
>
> Thank you very much for your efforts,
> best regards
>
> Dieter Jurzitza
>
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@
> https://lists.gnu.org/mailman/listinfo/help-octave
>
>
> Screenshot_histogram_linscale.jpg (168K)
> <http://octave.1599824.n4.nabble.com/attachment/4685756/0/Screenshot_histogram_linscale.jpg>
> Screenshot_histogram_logscale.jpg (126K)
> <http://octave.1599824.n4.nabble.com/attachment/4685756/1/Screenshot_histogram_logscale.jpg>
The problem is that bars (actually patch objects) are drawn with 0 as bottom
y coordinates. Here is a hack that works for me in 4.2.1 (but not in the
latest dev version strangely):
data = rand (5,3);
h = bar (data)
## Get the patch objects and replace 0 coordinates by the minimal value you
want to be displayed
ymin = 1e-3;
hpa = get (h, "children");
data = get (cell2mat (hpa), "ydata");
for ii = 1:numel (data)
tmp = data{ii};
tmp(tmp == 0) = ymin;
data{ii} = tmp;
endfor
set (cell2mat (hpa), {"ydata"}, data);
set (gca, "yscale", "log")
ylim ([ymin 1])
This is ugly I admit but I can't think of a better workaround ATM.
Pantxo
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html