Venn diagrams

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Venn diagrams

Francesco Potortì
I want to automatically draw three-circle Venn diagrams, and I have
stumpled upon
https://it.mathworks.com/matlabcentral/fileexchange/22282-venn

which seems to be the right thing.  Unfortunately, it gives errors:

octave> venn([3852 3766 1681 6932 5359 5184 39])
error: orderfields: structs must have same fields up to order
error: cat: field names mismatch in concatenating structs
error: called from
    venn>parseArgsIn at line 791 column 18
    venn at line 161 column 56

Before trying to debug it, anyone else has tried it?  Or does anyone
have suggestions for alteratives?

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Doug Stewart-4


On Fri, Jan 10, 2020 at 12:11 PM Francesco Potortì <[hidden email]> wrote:
I want to automatically draw three-circle Venn diagrams, and I have
stumpled upon
https://it.mathworks.com/matlabcentral/fileexchange/22282-venn

which seems to be the right thing.  Unfortunately, it gives errors:

octave> venn([3852 3766 1681 6932 5359 5184 39])
error: orderfields: structs must have same fields up to order
error: cat: field names mismatch in concatenating structs
error: called from
    venn>parseArgsIn at line 791 column 18
    venn at line 161 column 56

Before trying to debug it, anyone else has tried it?  Or does anyone
have suggestions for alteratives?

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it



Did you see this?
--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Francesco Potortì
Francesco Potortì:

>> I want to automatically draw three-circle Venn diagrams, and I have
>> stumpled upon
>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn
>>
>> which seems to be the right thing.  Unfortunately, it gives errors:
>>
>> octave> venn([3852 3766 1681 6932 5359 5184 39])
>> error: orderfields: structs must have same fields up to order
>> error: cat: field names mismatch in concatenating structs
>> error: called from
>>     venn>parseArgsIn at line 791 column 18
>>     venn at line 161 column 56
>>
>> Before trying to debug it, anyone else has tried it?  Or does anyone
>> have suggestions for alteratives?

Doug Stewart:
>Did you see this?
>https://octave.1599824.n4.nabble.com/Generate-venn-diagram-from-data-td4683112.html

Yes, thanks, but it only creates a two-circle diagram.

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

siko1056
On 1/11/20 9:31 AM, Francesco Potortì wrote:

> Francesco Potortì:
>>> I want to automatically draw three-circle Venn diagrams, and I have
>>> stumpled upon
>>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn
>>>
>>> which seems to be the right thing.  Unfortunately, it gives errors:
>>>
>>> octave> venn([3852 3766 1681 6932 5359 5184 39])
>>> error: orderfields: structs must have same fields up to order
>>> error: cat: field names mismatch in concatenating structs
>>> error: called from
>>>     venn>parseArgsIn at line 791 column 18
>>>     venn at line 161 column 56
>>>
>>> Before trying to debug it, anyone else has tried it?  Or does anyone
>>> have suggestions for alteratives?

I tried to debug it, but there is no hope without rewriting the entire
function.  The error observed by you is easily fixed, but there are many
nested functions and handles to those in use.  Thus there is no worth in
going too deep into it without total desperation and some spare time, I
am afraid.

>
> Doug Stewart:
>> Did you see this?
>> https://octave.1599824.n4.nabble.com/Generate-venn-diagram-from-data-td4683112.html
>
> Yes, thanks, but it only creates a two-circle diagram.
>

Alternatively, I asked Google [1,2] and got this to work:
_____________________________________________________________
1; % script



function h = circle(x,y,r)

d = r*2;

px = x-r;

py = y-r;

h = rectangle('Position',[px py d d],'Curvature',[1,1], ...

    'FaceColor',rand(1,3),'EdgeColor','b',...

    'LineWidth',3,'facealpha',0.5);

daspect([1,1,1])

end



circle (0,0,5)

circle (4,1,6)
circle (-1,5,6)
_____________________________________________________________

Please adapt to your needs.

[1]:
https://www.mathworks.com/matlabcentral/answers/98665-how-do-i-plot-a-circle-with-a-given-radius-and-center#answer_108013
[2]:
https://stackoverflow.com/questions/12072412/setting-transparancy-of-surface-plot-on-octave/24173227

HTH,
Kai


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Sebastian Schöps
siko1056 wrote
> On 1/11/20 9:31 AM, Francesco Potortì wrote:
>> Francesco Potortì:
>>>> I want to automatically draw three-circle Venn diagrams, and I have
>>>> stumpled upon
>>>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn
>>>> which seems to be the right thing.  Unfortunately, it gives errors:
> ....

I know, it's the Octave mailing list ... but since you are an academic, did
you consider tikz/latex
(http://www.texample.net/tikz/examples/venn-diagram/)? Maybe even scripted
via Octave?
This would most probably be my solution.

Sebastian



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


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Francesco Potortì
In reply to this post by siko1056
>>>> I want to automatically draw three-circle Venn diagrams, and I have
>>>> stumpled upon
>>>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn
...
>>>> Before trying to debug it, anyone else has tried it?  Or does anyone
>>>> have suggestions for alteratives?
>
>I tried to debug it, but there is no hope without rewriting the entire
>function.  The error observed by you is easily fixed, but there are many
>nested functions and handles to those in use.  Thus there is no worth in
>going too deep into it without total desperation and some spare time, I
>am afraid.

Doug, thanks a lot for your work, I'll try a different direction for
showing my results :)

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Francesco Potortì
In reply to this post by Sebastian Schöps
Francesco Potortì:
>>>>> I want to automatically draw three-circle Venn diagrams, and I have
>>>>> stumpled upon
>>>>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn
>>>>> which seems to be the right thing.  Unfortunately, it gives errors:
>> ....

Sebastian Schöps:
>I know, it's the Octave mailing list ... but since you are an academic, did
>you consider tikz/latex
>(http://www.texample.net/tikz/examples/venn-diagram/)? Maybe even scripted
>via Octave?
>This would most probably be my solution.

Thanks!  I'll loo into that

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Francesco Potortì
In reply to this post by siko1056
Francesco Potortì:
>>>> I want to automatically draw three-circle Venn diagrams, and I have
>>>> stumpled upon
>>>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn

Kai Torben Ohlhus:
>I tried to debug it, but there is no hope without rewriting the entire
>function.

Doug Stewart:
>h = rectangle('Position',[px py d d],'Curvature',[1,1], ...
>    'FaceColor',rand(1,3),'EdgeColor','b',...
>    'LineWidth',3,'facealpha',0.5);
>daspect([1,1,1])

Kai, Doug, thank you both.  Sometimes something as simple as having to
start from scratch plus drawing three trasparent overlapping discs can
awake one's coding appetite :)

In the end I wrote functions to draw 2- and 3-circles Venn diagrams.
The core is there and seems to work well.  Missing things are better
documentation, some more tests, and user interface improvements (ok,
maybe the name too...)

The code is at http://fly.isti.cnr.it/pub/software/octave/venn3circles.m

To give it a try, just do
octave> demo venn3circles

I need some advice.

- What type of interface should I use (arguments, output results, help
  text for functions)?  Maybe take
  https://it.mathworks.com/matlabcentral/fileexchange/22282-venn as a
  model?  Or else, which Octave function do you suggest as template?

- Should I try and add utilities for creating full-featured Venn
  diagrams (labels, legend)?  Ideas welcome.

- Should I try and make the syntax Matlab-compatible?  I have never
  tried this, maybe it is not worth, as I have no easy way to keep
  checking for compatibility in the future as I do not use Matlab

- There is some introductory text at the beginning of the file, plus
  some docs for each function.  Is there a standard way where and how to
  put a general discussion (documentation) about the software?

- Would it make sense to contact some package author and work to include
  this in into a package? Which one?

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

Francesco Potortì
In reply to this post by Sebastian Schöps
Francesco Potortì:
>>>>> I want to automatically draw three-circle Venn diagrams, and I have
>>>>> stumpled upon
>>>>> https://it.mathworks.com/matlabcentral/fileexchange/22282-venn
>>>>> which seems to be the right thing.  Unfortunately, it gives errors:
>> ....

Sebastian Schöps:
>I know, it's the Octave mailing list ... but since you are an academic, did
>you consider tikz/latex
>(http://www.texample.net/tikz/examples/venn-diagram/)? Maybe even scripted
>via Octave?

Thank you Sebastian, but I would like to get drawings where the areas are
really the requested ones, so to get a visual impression of the aret ratios.

The program I wrote does just this.  Again:

http://fly.isti.cnr.it/pub/software/octave/venn3circles.m

and try

octave> demo venn3circles


--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(gate 20, 1st floor, room C71)         Web:    http://fly.isti.cnr.it


Reply | Threaded
Open this post in threaded view
|

Re: Venn diagrams

siko1056
In reply to this post by Francesco Potortì
On 1/20/20 10:30 AM, Francesco Potortì wrote:

>
> In the end I wrote functions to draw 2- and 3-circles Venn diagrams.
> The core is there and seems to work well.  Missing things are better
> documentation, some more tests, and user interface improvements (ok,
> maybe the name too...)
>
> The code is at http://fly.isti.cnr.it/pub/software/octave/venn3circles.m
>
> To give it a try, just do
> octave> demo venn3circles
>
> I need some advice.
>
> - What type of interface should I use (arguments, output results, help
>   text for functions)?  Maybe take
>   https://it.mathworks.com/matlabcentral/fileexchange/22282-venn as a
>   model?  Or else, which Octave function do you suggest as template?


If you want to win users over from ML fileexchange to your function,
this is a good idea.  They can just use a common interface in both
Octave and Matlab, if you decide to support both (see below).


> - Should I try and add utilities for creating full-featured Venn
>   diagrams (labels, legend)?  Ideas welcome.


I would prefer a lightweight interface which allows easy customization.
 Why caring about labels in a venn-diagram function, if I can add labels
with the respective command (one function, one purpose)?


> - Should I try and make the syntax Matlab-compatible?  I have never
>   tried this, maybe it is not worth, as I have no easy way to keep
>   checking for compatibility in the future as I do not use Matlab


This depends on your intended code location.  If it should go into
Octave core, or should become an Octave Forge community package,
Matlab-compatibility is almost impossible.  You have to use "#"
comments, for example.


> - There is some introductory text at the beginning of the file, plus
>   some docs for each function.  Is there a standard way where and how to
>   put a general discussion (documentation) about the software?


Again, this depends on your intended code location.  For Octave core
there is the user manual for general documentation

   https://octave.org/doc/interpreter/

OF packages have their custom manual, e.g.

   https://octave.sourceforge.io/interval/package_doc/

or the wiki

   https://wiki.octave.org/Interval_package


> - Would it make sense to contact some package author and work to include
>   this in into a package? Which one?


When looking at the overview, unfortunately, only the "miscellaneous"
packages comes to my mind...

  https://octave.sourceforge.io/miscellaneous/overview.html
  https://octave.sourceforge.io/packages.php

Maybe start an own one.  A package in my opinion should not consists of
only one function, but if you have venn3(), venn2(), why not an own
package (one tool, one purpose)?

HTH,
Kai