Is it possible to do this in Inkscape?

General discussions about Inkscape.
tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Is it possible to do this in Inkscape?

Postby tidus_chan » Fri Oct 11, 2013 1:06 am

Dear all,

I have recently jumped into Inkscape as a starter, as I have found quite a lot of high-quality image is made in .svg format (in particular, on WikiMedia Commons)

These days I have been writing my academic report and really want to generate high-quality image. That leads me to something: Quite long time back I came across a figure like below (it was extracted by myself from a PhD thesis and the figure, I suppose, is in .svg format)

Image.

This figure has used other .svg file, like http://commons.wikimedia.org/wiki/File:ConductionsystemoftheheartwithoutHeart.svg

But what makes me very curious is that, how the author generate the ECG time series on the right? So far I have been using Microsoft Visio 2010 and I am quite sure that it can't do this. I used Photoshop quite a long time back, and I think it can't either.

Can Inkscape possibly import some sort of data and plot them along with .svg import file? Or, any other software you may know that can do this ?? ;) ;)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Is it possible to do this in Inkscape?

Postby Lazur » Fri Oct 11, 2013 7:45 am

Welcome aboard!

At this topic there are some plotting programs mentioned:
matplotlib
veusz
I belive they can plot curves based on some data, that you can export as svg and open in inkscape.

I have no idea how would you get such data though, as medical devices already make a graphical output?
Maybe retracing those manually/automatically can give reasonable results much easier.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to do this in Inkscape?

Postby tylerdurden » Fri Oct 11, 2013 8:03 am

I have occasionally used LibreOffice to plot graphs and waveforms... The charts in LibreOffice are vector, so they can easily be copied and pasted into Inkscape.

stretchVert.png
stretchVert.png (9.61 KiB) Viewed 6485 times
Attachments
stretchVert.svg
(5.17 KiB) Downloaded 242 times
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to do this in Inkscape?

Postby v1nce » Fri Oct 11, 2013 9:29 am

tidus_chan wrote:But what makes me very curious is that, how the author generate the ECG time series on the right?
So far I have been using Microsoft Visio 2010 and I am quite sure that it can't do this.

Don't have used V for years now but I think you can use nurbs. And, if you probably can't import raw data, I'm rather confident you can plot in excel and cut/paste into Vision

tidus_chan wrote: I used Photoshop quite a long time back, and I think it can't either.

Can Inkscape possibly import some sort of data and plot them along with .svg import file? Or, any other software you may know that can do this ?? ;) ;)


If your data are (ordered) x,y couples you just have to write

<svg>
<path style="fill:none;stroke:#000000;" d="M %yourdata%" />
</svg>

in a text file named foo.svg and voila (minus the scaling but you can do it in inkscape)
Last edited by v1nce on Fri Oct 11, 2013 9:18 pm, edited 2 times in total.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to do this in Inkscape?

Postby tylerdurden » Fri Oct 11, 2013 9:55 am

Nice...
Thanks for the tip!

foo2.png
foo2.png (17.5 KiB) Viewed 6472 times
Attachments
foo2.svg
(2.39 KiB) Downloaded 241 times
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Is it possible to do this in Inkscape?

Postby ragstian » Fri Oct 11, 2013 10:39 am

Hi

To get the "heart-beat" curve for my "Create Heart" tutorial http://www.inkscapeforum.com/viewtopic.php" onclick="readonly();return false;"http://www.swharden.com/blog/2009-08-06-defibrillating-my-diy-ecg-project/" class="postlink">http://www.swharden.com/blog/2009-08-06-defibrillating-my-diy-ecg-project/
The output can be saved as SVG and used in Inkscape.

As Lazur mentioned it's easy to plot data sets using matplotlib in python. See example here, http://www.pybytes.com/pywfdb/example-drawing.html Full article here; http://www.pybytes.com/pywfdb/

Here you can find an applet for generating synthetic ECG data; http://www.physionet.org/physiotools/ecgsyn/Java/ecgsyn-java.html Full article here. http://www.physionet.org/physiotools/ecgsyn/

v1nce's method was new to me, will do some experiments.
For plotting large datasets with nice annotation's etc I have used Veusz; http://home.gna.org/veusz/

Good Luck
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to do this in Inkscape?

Postby tylerdurden » Fri Oct 11, 2013 10:27 pm

Here's an un-touched waveform with ~3K datapoints, made just pasting v1nce's code to the dataset. No problem for inkscape, even on an old computer.
Attachments
foo3.svg
(36.02 KiB) Downloaded 247 times
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Re: Is it possible to do this in Inkscape?

Postby tidus_chan » Wed Oct 16, 2013 5:03 am

Thank you all for your replies above!!! I will try to reply back in order.

Lazur URH wrote:Welcome aboard!

At this topic there are some plotting programs mentioned:
matplotlib
veusz
I belive they can plot curves based on some data, that you can export as svg and open in inkscape.

I have no idea how would you get such data though, as medical devices already make a graphical output?
Maybe retracing those manually/automatically can give reasonable results much easier.


Thanks for that. I have already tried to use Inkscrape and Veusz (I've found Veusz very nice!).

1. For Inkscrape, there's still one problem for me. Once I imported a .svg image, it has been grouped by the creator, and the problem for me is that whether there's any way to see how many subobjects (grouped or ungrouped) are present underneath the original image? I found it sometimes quite annoying as I ungrouped the original image (as the highest-level object), the subobjects underneath are often overlapping each other. Say I want to delete one particular subobject (perhaps down at 5 or 6 level), I need to ungroup the first level, and then find the particular object that contains the subobject I want to delete and ungroup it, and again loop what I did until we get to 5 or 6 level, after which I can finally delete that object.
It looks straightaway to me, though, if I am doing it in Photoshop, where we got layers and layers. I know in Inkscrape there's a 'layer' concept. But it seems to me that some .svg images group everything into an object and you can't see any particular objects in the 'layer' tab. Is there anyway to see all the subobjects within one particular object??

2. For Veusz, it is great! I am trying out something and importing it into Inkscrape in the near future. Hope I can get something out of it.
3. For the medical data, actually we have sources. So we can get the digital data and plot them via Veusz. Should be fine in this sense.

tylerdurden wrote:I have occasionally used LibreOffice to plot graphs and waveforms... The charts in LibreOffice are vector, so they can easily be copied and pasted into Inkscape.

stretchVert.png


Could be an option for me. Will try! :-)


v1nce wrote:
tidus_chan wrote:But what makes me very curious is that, how the author generate the ECG time series on the right?
So far I have been using Microsoft Visio 2010 and I am quite sure that it can't do this.

Don't have used V for years now but I think you can use nurbs. And, if you probably can't import raw data, I'm rather confident you can plot in excel and cut/paste into Vision

tidus_chan wrote: I used Photoshop quite a long time back, and I think it can't either.

Can Inkscape possibly import some sort of data and plot them along with .svg import file? Or, any other software you may know that can do this ?? ;) ;)


If your data are (ordered) x,y couples you just have to write

<svg>
<path style="fill:none;stroke:#000000;" d="M %yourdata%" />
</svg>

in a text file named foo.svg and voila (minus the scaling but you can do it in inkscape)

1. Well, we can plot in excel and cut/paste into Visio. But it seems that doing so would only result in bitmap image as for the data plot in Visio. Have tried importing as an object in Visio from Excel, but doesn't work quite well.
2. Can't really understand your method here. Could you specify it in a bit more detail? Thank you for your time!! :-)

ragstian wrote:Hi

To get the "heart-beat" curve for my "Create Heart" tutorial http://www.inkscapeforum.com/viewtopic.php" onclick="readonly();return false;"http://www.swharden.com/blog/2009-08-06-defibrillating-my-diy-ecg-project/" class="postlink">http://www.swharden.com/blog/2009-08-06-defibrillating-my-diy-ecg-project/
The output can be saved as SVG and used in Inkscape.

As Lazur mentioned it's easy to plot data sets using matplotlib in python. See example here, http://www.pybytes.com/pywfdb/example-drawing.html Full article here; http://www.pybytes.com/pywfdb/

Here you can find an applet for generating synthetic ECG data; http://www.physionet.org/physiotools/ecgsyn/Java/ecgsyn-java.html Full article here. http://www.physionet.org/physiotools/ecgsyn/

v1nce's method was new to me, will do some experiments.
For plotting large datasets with nice annotation's etc I have used Veusz; http://home.gna.org/veusz/

Good Luck
RGDS
Ragnar


1. First of all, thanks for sharing the tutorial and plotting in python!! I think at some point I may try it out!
2. Thanks! I think for the time being, I will try Veusz first. It seems it's easier for me to generate plot in .svg, which can be imported into Inkscrape!
3. Right now I have sources of real data. So synthetic ECG data is not in my schedule yet. But who knows I may try it out later! Thanks!
4. Not quite sure how to implement v1nce's method though, still new to Inkscrape.
5. Yes. I am trying to get myself used to Veusz.

tylerdurden wrote:Here's an un-touched waveform with ~3K datapoints, made just pasting v1nce's code to the dataset. No problem for inkscape, even on an old computer.

1. Sorry, can you specify how to do it?? To be honest, I am a bit lost in v1nce's method, though it seems quite easy to do. :oops:


Thanks for all your replies!

regards,
Tidus

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to do this in Inkscape?

Postby v1nce » Wed Oct 16, 2013 8:15 am

tidus_chan wrote:1. Well, we can plot in excel and cut/paste into Visio. But it seems that doing so would only result in bitmap image as for the data plot in Visio. Have tried importing as an object in Visio from Excel, but doesn't work quite well.
2. Can't really understand your method here. Could you specify it in a bit more detail? Thank you for your time!! :-)


1) it could be my memory that fools me.
2) as svg are text file it's rather easy to plot data.

A) You could EDIT A TEXT FILE AND OPEN IT INKSCAPE

it's an easy one and it only requires a basic text editor. As you're dealing with data you probably got one already opened.
Say your data are time based with a constant sampling rate (you measure a physical parameter every xnth second) and your data are as follow
1, 100
2, 80
3, 56...

You open the text file that contains your data with an editor that can edit raw text (notepad, notepad++,jedit,pspad...). Don't open it with Word or worpad.
You add <svg><path style="fill:none;stroke:#000" d="M at the very start of you file.
You add "></svg> at the end.
You save your new text with any name you want. You just have to make sure its extension is ".svg"
Now open the svg in inkscape (or drag it to a document already opened) you should see your data.

or B) PASTE YOUR DATA DIRECTLY IN INKSCAPE

open the text file containing your data in a text editor. Copy all (ctrl A, ctrl C)
launch inkscape.
draw any shape using the :tool_pencil: tool.
display the xml editor in inkscape (shift ctrl x)
a new window should popup
on the left panel, a node starting with svg:path id=.... should be highlighted.
on the right panel, you should see a key/value list.
use slider until you see a property "d" (should be easy it should be the 1st one)
select it.
under the key/value list there are two text input. The first one should be "d" . And the second is filled with "garbage" (in fact, its the coordinates of all points).
Clear the second one (eg click, ctrl A, del).
Input "M " (without the " but the space is important)
Paste your data into the second input ( = after the M you just entered).
Click the Set button.

Image

Voila.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Is it possible to do this in Inkscape?

Postby Lazur » Wed Oct 16, 2013 8:55 am

tidus_chan wrote:...
For Inkscrape, there's still one problem for me. Once I imported a .svg image, it has been grouped by the creator, and the problem for me is that whether there's any way to see how many subobjects (grouped or ungrouped) are present underneath the original image? I found it sometimes quite annoying as I ungrouped the original image (as the highest-level object), the subobjects underneath are often overlapping each other. Say I want to delete one particular subobject (perhaps down at 5 or 6 level), I need to ungroup the first level, and then find the particular object that contains the subobject I want to delete and ungroup it, and again loop what I did until we get to 5 or 6 level, after which I can finally delete that object.
It looks straightaway to me, though, if I am doing it in Photoshop, where we got layers and layers. I know in Inkscrape there's a 'layer' concept. But it seems to me that some .svg images group everything into an object and you can't see any particular objects in the 'layer' tab. Is there anyway to see all the subobjects within one particular object??
---


Through the mentioned xml editor panel you can see each group of objects.
I don't use that for such purpose though.
Usually complicated grouping is used in imported pdf-s.
With them it's better to get rid all of the grouping.
There can be other more ugly solutions in them too that can be a pain to correct.

Anyway, you can use the node editor tool to selects paths inside of groups without the need of any ugrouping, then by pressing Space it will in most cases bring you the select object tool.
And with the help of that, you can select and delete unwanted parts sometimes easier.
Entering a group can be done by double clicking on it and exiting by selecting an object outside the group.
Or a more "polite" way, enter by pressing Ctrl+Enter when group selected, and exit by pressing Ctrl+Backspace.
With the node editor tool you can enter nested groups in one step, but to exit the group you will have to go the ways described with the two other methods.

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Is it possible to do this in Inkscape?

Postby tylerdurden » Wed Oct 16, 2013 9:44 am

Hello, Tidus,

To re-iterate V1nce's comments...

A segment of my data looks like this (x,y x,y x,y...):

Code: Select all

1,-20.48 2,-24.67 3,-23.52 4,-18.63 5,-17.99 6,-15.89 7,-15.41 8,-14.37 9,-14.39 10,-14.12 11,-14.23 12,-14.56 13,-15.11 14,-16.25 15,-17.37 16,-19.05 17,-20.26 18,-21.93 19,-22.96 20,-23.92 21,-25.14 22,-27.69 23,-30.72 24,-34.16 25,-38.97 26,-55.82 27,-42.01 28,-39.09 29,-44.25 30,-44.73 31,-49.25 32,-44.12 33,-38.29 34,-38.18 35,-37.03 36,-32.46 37,-30.41 38,-27.81 39,-25.96 40,-23.73 41,-22.55 42,-20.78 43,-20.25 44,-19.15 45,-18.42 46,-18.26 47,-18.10 48,-18.38 49,-18.04 50,-18.25 51,-18.30 52,-18.24 53,-18.63 54,-19.06 55,-19.46 56,-19.83 57,-20.42 58,-20.67 59,-21.72 60,-22.40 61,-23.75 62,-23.81 63,-24.40 64,-24.89 65,-25.47 66,-27.27 67,-27.83 68,-28.85 69,-27.26 70,-29.06 71,-16.62 72,-24.58 73,-42.81 74,-22.83 75,-33.25 76,-35.57 77,-21.75 78,-24.17 79,-18.55 80,-18.13 81,-19.23 82,-12.96 83,-12.93 84,-8.74 85,-7.68 86,-5.97
( Of course, x is the the time base, so it increments at regular intervals: 1 2 3 4 5... )

I use Textpad (free text editor) to paste the data into the tags:

Code: Select all

<svg>
<path style="fill:none;stroke:#000000;" d="M

1,-20.48 2,-24.67 3,-23.52 4,-18.63 5,-17.99 6,-15.89 7,-15.41 8,-14.37 9,-14.39 10,-14.12 11,-14.23 12,-14.56 13,-15.11 14,-16.25 15,-17.37 16,-19.05 17,-20.26 18,-21.93 19,-22.96 20,-23.92 21,-25.14 22,-27.69 23,-30.72 24,-34.16 25,-38.97 26,-55.82 27,-42.01 28,-39.09 29,-44.25 30,-44.73 31,-49.25 32,-44.12 33,-38.29 34,-38.18 35,-37.03 36,-32.46 37,-30.41 38,-27.81 39,-25.96 40,-23.73 41,-22.55 42,-20.78 43,-20.25 44,-19.15 45,-18.42 46,-18.26 47,-18.10 48,-18.38 49,-18.04 50,-18.25 51,-18.30 52,-18.24 53,-18.63 54,-19.06 55,-19.46 56,-19.83 57,-20.42 58,-20.67 59,-21.72 60,-22.40 61,-23.75 62,-23.81 63,-24.40 64,-24.89 65,-25.47 66,-27.27 67,-27.83 68,-28.85 69,-27.26 70,-29.06 71,-16.62 72,-24.58 73,-42.81 74,-22.83 75,-33.25 76,-35.57 77,-21.75 78,-24.17 79,-18.55 80,-18.13 81,-19.23 82,-12.96 83,-12.93 84,-8.74 85,-7.68 86,-5.97

" />
</svg>

You can copy the above code and save as foo3x.svg and see it in Inkscape. Or, substitute your data in place of mine, save and view/edit in Inkscape.

Regards,
TD
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Re: Is it possible to do this in Inkscape?

Postby tidus_chan » Wed Oct 16, 2013 7:14 pm

v1nce
---------------------
Thank you so much for the detailed explanation. That really helps!
In fact, before I read this post, I tried it myself with the examples I downloaded under this topic and it worked! Of course, the build-in XML Editor seems more efficient to me, though I use quite a lot of NotePad++! :-) I NEVER programmed XML before, but now I am getting some ideas around it!

Lazur URH
---------------------
Thanks for that!
I've found the SPACE really useful in this case. I've also found that, by using the build-in XML editor as an subject explorer, I can delete attributes of a object. Say we got a path, in which we have attr. 'd'. Deleting 'd' would result in eliminating the path's 'd', which 'superficially' delete that object in the canvas. But I am still a bit sceptical about this method, 'cause deleting 'd' seems to work, but in essence the path still exists. Not sure whether this method works well.

tylerdurden
---------------------
Thanks for the contribution. I also found your post really useful too! :-)

Thanks all.

regards,
Tidus

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Is it possible to do this in Inkscape?

Postby v1nce » Wed Oct 16, 2013 11:51 pm

for dynamic svg inspiration you could have a look at

https://github.com/mbostock/d3/wiki/Gallery

80% of samples are done using svg

tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Re: Is it possible to do this in Inkscape?

Postby tidus_chan » Thu Oct 17, 2013 1:32 am

v1nce wrote:for dynamic svg inspiration you could have a look at

https://github.com/mbostock/d3/wiki/Gallery

80% of samples are done using svg

That's awesome! Thanks for that! :D

tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Re: Is it possible to do this in Inkscape?

Postby tidus_chan » Thu Oct 17, 2013 2:25 am

A bit more help is needed here again.

Image

Can any one tell me how to draw the arrow like the graph above shows?

I tried drawing an path as a arrow. It works quite well if the arrow as a whole is straight; but I don't know how to bend SMOOTHLY like the graph does. I tried :tool_node: by adding a bit more nodes around the prospective corner and tuned nodes and Bezier handles etc. to make it sleek, but I failed.

Any ideas?

thanks,
Tidus


hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Is it possible to do this in Inkscape?

Postby hulf2012 » Thu Oct 17, 2013 3:53 am

Can any one tell me how to draw the arrow like the graph above shows?

I tried drawing an path as a arrow. It works quite well if the arrow as a whole is straight; but I don't know how to bend SMOOTHLY like the graph does. I tried :tool_node: by adding a bit more nodes around the prospective corner and tuned nodes and Bezier handles etc. to make it sleek, but I failed.

Any ideas?


Hello
One way is:
In this case that one of the best solutions is using The Bend Path Effect. It seems to me that it's very easy to use, see here:
http://tavmjong.free.fr/INKSCAPE/MANUAL ... dTool.html

However, the advice is that always put your arrow in an horizontal direction, try not to rotate or scale. After you achieved to bend your arrow, convert it to a path with Ctrl+Shift+C. After that you can rotate or scale or movewith more freedom. You can also simplificate it with Ctrl+L.

Other way is:
Create a path without fill, just as stroke, and just edit the stroke for bending and extend it. In the dialog for the stroke you can put the head arrow that you want. Wide the stroke. After that use the tool convert the stroke to path (Ctrl+Alt+C).
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Re: Is it possible to do this in Inkscape?

Postby tidus_chan » Thu Oct 17, 2013 4:23 am

v1nce wrote:http://tavmjong.free.fr/INKSCAPE/MANUAL/html/Paths-LivePathEffects-PatternAlongPath.html


Thanks for that. Thought I was getting a bit lazy in finding it myself... :oops:

tidus_chan
Posts: 9
Joined: Fri Oct 11, 2013 12:48 am

Re: Is it possible to do this in Inkscape?

Postby tidus_chan » Thu Oct 17, 2013 6:29 am

hulf2012 wrote:Hello
One way is:
In this case that one of the best solutions is using The Bend Path Effect. It seems to me that it's very easy to use, see here:
Top


Return to “General Discussions”