histogram with logscale ...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

histogram with logscale ...

Dr.-Ing. Dieter Jurzitza
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
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

Screenshot_histogram_linscale.jpg (168K) Download Attachment
Screenshot_histogram_logscale.jpg (126K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: histogram with logscale ...

Pantxo
[hidden email] 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

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: histogram with logscale ...

Dr.-Ing. Dieter Jurzitza
Dear listmembers,
der Panxto,
thank you for the hint - well, as I use the octave version 4.2.1 right now
this is working for me as well!

However, due to other similar issues/problems with the graphical
representation I could achieve I dumped a set of gnuplot commands into a file
now and did directly what I wanted to do.

It is a user friendly approach to try to hide the actual graphical interface
of a secondary tool from the user in order to allow him to learn one single
language only. However there ought to be a means for dumping the commands
controlling the secondary tool into i.e. a data- and a plotfile on request
IMHO.

By the way: this has to exist anyway as this is mandatory in order to print
for example with gnuplot. And whether one pipes something to an application or
writes into a file ought to be not a big thing.

Such issues like the one discussed right now (and several more I've been
stumbling across during the last years) could be solved on the direct way,
then.

Neither gnuplot nor octave are perfect when it comes to achieving printouts
the way one needs them. However it becomes very difficult if the tweaks for
tool "A" you are aware of are kind of hidden behind a meta language within
tool "B" so you cannot access them the direct way.

My 2 cents only.

Thanks again,
best regards


Dieter Jurzitza

Am Donnerstag, 30. November 2017, 05:53:08 schrieb Pantxo:
******

>
> 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;
*******

--
-----------------------------------------------------------
Dr.-Ing. Dieter Jurzitza                    76131 Karlsruhe


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: histogram with logscale ...

Pantxo
Dr.-Ing. Dieter Jurzitza wrote

> Dear listmembers,
> der Panxto,
> thank you for the hint - well, as I use the octave version 4.2.1 right now
> this is working for me as well!
>
> However, due to other similar issues/problems with the graphical
> representation I could achieve I dumped a set of gnuplot commands into a
> file
> now and did directly what I wanted to do.
>
> It is a user friendly approach to try to hide the actual graphical
> interface
> of a secondary tool from the user in order to allow him to learn one
> single
> language only. However there ought to be a means for dumping the commands
> controlling the secondary tool into i.e. a data- and a plotfile on request
> IMHO.
>
> By the way: this has to exist anyway as this is mandatory in order to
> print
> for example with gnuplot. And whether one pipes something to an
> application or
> writes into a file ought to be not a big thing.
>
> Such issues like the one discussed right now (and several more I've been
> stumbling across during the last years) could be solved on the direct way,
> then.
>
> Neither gnuplot nor octave are perfect when it comes to achieving
> printouts
> the way one needs them. However it becomes very difficult if the tweaks
> for
> tool "A" you are aware of are kind of hidden behind a meta language within
> tool "B" so you cannot access them the direct way.
>
> My 2 cents only.
>
> Thanks again,
> best regards
>
>
> Dieter Jurzitza
>
> Am Donnerstag, 30. November 2017, 05:53:08 schrieb Pantxo:
> ******
>>
>> 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;
> *******
>
> --
> -----------------------------------------------------------
> Dr.-Ing. Dieter Jurzitza                    76131 Karlsruhe
>
>
> _______________________________________________
> Help-octave mailing list

> Help-octave@

> https://lists.gnu.org/mailman/listinfo/help-octave

Dieter,

On this list we use bottom posting : we write after cited texts as I
currently do.

For issue (1), I just realized that we just need to move the baseline. Here
a much cleaner and direct way to handle log scales with bar plots (and that
works with both 4.2 and dev Octave):

data = rand (5,3);
h = bar (data);
ymin = 1e-3;
set (h, "basevalue", ymin);
set (gca, "yscale", "log")  


As for gnuplot I can't help. Dan who actively maintains the gnuplot
interface probably has useful tricks to debug piped commands.

>> ... and several more I've been stumbling across during the last years

I think what we need is to be able to eliminate the gnuplot toolkit at some
point -and I admit we are far from ready to do it- but, for this to happen,
the priority is to report and fix bugs in OpenGL toolkits (and its printing
system) rather than providing hacky ways to post-process graphics in
gnuplot.

That's my 2 cent,

Pantxo
Did you report bug reports?
 






--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave