help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bar plot with logarithmic scale on y-axis


From: Juan Pablo Carbajal
Subject: Re: Bar plot with logarithmic scale on y-axis
Date: Mon, 24 Mar 2014 13:53:58 +0100

On Mon, Mar 24, 2014 at 12:48 PM, Damian Harty <address@hidden> wrote:
>> I'd like to plot my data in a bar chart with log scale on the y-axis. Here's 
>> what I tried:
>
>> h = bar ([1:10]',rand(10,1));
>> set (gca,'yscale','log');
>
>> The first command produces the expected bar chart. The second command scales
>> the y-axis as expected, but the bars in the plot get screwed up. Can someone
>> please help me with this?
>
> I think the plotting algorithm tries to draw the boxes for the bars from zero 
> and flags a logarithm domain error at this point. Excel handles this 
> "intuitively" but alas Octave only draws the top of the bar.
>
> I have 3 options to offer:
>
> 1) Edit the code to do what you want (be careful what you wish for)
> 2) Make a new variable that is the log of your data and plot that on 
> appropriately annotated scales
> 3) Plot the data in Excel or similar
>
>
>
>
> CONFIDENTIAL: The information contained in this email communication is 
> confidential information intended only for the use of the addressee. 
> Unauthorized use, disclosure or copying of this communication is strictly 
> prohibited and may be unlawful. If you have received this communication in 
> error, please notify us immediately by return email and destroy all copies of 
> this communication, including all attachments.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

Remember that you can get help using the command
 > help bar

In this case you will see that the option "basevalue" solves your problem. e.g.

h = bar ([1:10]',rand(10,1),"basevalue",1e-8);
set (gca,'yscale','log');


reply via email to

[Prev in Thread] Current Thread [Next in Thread]