I'd hesitate to make that change since as you say the bug is in Octave
itself.. We shouldn't add additional cruft to work around bugs when we
can fix the issue at the source..
This reason this issue is happening is that "isvector([])" returns false
whereas "isvector(zeros(1,0))" returns true which is the matlab
compatible behavior. Therefore the fix is to promote the test for empty
variable in the base plotting code to be first as in the attached
changeset.
Regards
David
Shaun Jackman wrote:
> boxplot 1.4.1 does not work with octave 3.0.0 for me. If the boxplot
> does not have any outliers, the resulting plot is empty. The
> following fix worked for me. I'd be curious to know if there's a more
> elegant solution.
>
> When the boxplot has no outliers, the variables outliers_x and
> outliers_y become empty 0x1 matrices:
> outliers_x = [](0x1)
> outliers_y = [](0x1)
>
> Evidently the plot function can't deal with this. I could see this
> being a bug in plot though, rather than a bug in boxplot. I would
> expect the plot function to treat a 1x0 empty matrix the same as a
> 0x0 empty matrix.
>
> Cheers,
> Shaun
>
> --- boxplot.m.orig 2008-03-26 14:27:15.000000000 -0700
> +++ boxplot.m 2008-03-26 15:43:19.000000000 -0700
> @@ -182,6 +182,16 @@
> #median_x,median_y
> #cap_x,cap_y
>
> +if min(size(outliers_x)) == 0
> + outliers_x = [];
> + outliers_y = [];
> +endif
> +
> +if min(size(outliers2_x)) == 0
> + outliers2_x = [];
> + outliers2_y = [];
> +endif
> +
> ## Do the plot
> if vertical
> plot (quartile_x, quartile_y, "b;;",
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Octave-dev mailing list
> Octave-dev@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/octave-dev
>
>
--
David Bateman [EMAIL PROTECTED]
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
# HG changeset patch
# User David Bateman <[EMAIL PROTECTED]>
# Date 1206696057 -3600
# Node ID a772298082019087bb0fea1a2903ac89a303c8a4
# Parent 2dff3568e75399b71cc0f4e8d7b27f74bf267d26
Fix for plot(zeros(1,0),zeros(1,0))
diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@ 2008-03-27 David Bateman <[EMAIL PROTECTED]
+2008-03-27 David Bateman <[EMAIL PROTECTED]>
+
+ * plot/__plt2__.m: Test if args are empty first so that
+ plot(zeros(1,0),zeros(1,0)) works as expected.
+
2008-03-27 David Bateman <[EMAIL PROTECTED]>
* plot/plotyy.m: The axis handle is a two element vector and
diff --git a/scripts/plot/__plt2__.m b/scripts/plot/__plt2__.m
--- a/scripts/plot/__plt2__.m
+++ b/scripts/plot/__plt2__.m
@@ -48,7 +48,9 @@ function retval = __plt2__ (h, x1, x2, o
endif
h_set = false;
- if (isscalar (x1))
+ if (isempty (x1) && isempty (x2))
+ retval = zeros (0, 1);
+ elseif (isscalar (x1))
if (isscalar (x2))
retval = __plt2ss__ (h, x1, x2, options, properties);
elseif (isvector (x2))
@@ -74,8 +76,6 @@ function retval = __plt2__ (h, x1, x2, o
else
error ("__plt2__: invalid data for plotting");
endif
- elseif (isempty (x1) && isempty (x2))
- retval = zeros (0, 1);
else
error ("__plt2__: invalid data for plotting");
endif
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev