Gnuplot plot visualization inside paraview 2D view - gnuplot

I have plots made with some Gnuplot scripts already. Is there a way to introduce Gnuplot plots in a Paraview 2D view?
The dirty way that I've found is: first I generate a png image and import it later from Paraview and finally visualize it in a 2D view.
Does anyone know a better alternative to achieve this?

Paraview has a Python view which allows to define a python script for creating 2d plots ( http://www.kitware.com/blog/home/post/704 , http://www.kitware.com/blog/home/post/588)
Maybe you can use a python interface to gnuplot (for example http://gnuplot-py.sourceforge.net/ ) and insert your script in the Python view properties.

Related

How to have a background image in Altair Python

I'm trying to use Altair to have a dynamic map, I can easily do the dynamic part, however I am trying to add an image as background of the plot (bitmap image), I cannot find any functions in this purpose and every example on the Altair documentation is based on Url/Json feature. Does anyone have already done this kind of plot ? Is it possible to maybe combine a matplotlib with the background image and a dynamic part such as in Altair ?
Thanks Everyone,
Antoine.
It is not possible to embed a bitmap image within Altair. Vega supports an image mark, but that has not yet made its way into Vega-Lite, which drives the API of Altair.
Requests for this feature in Vega-Lite can be tracked in this GitHub Issue.

How to split a STL into surfaces in VTK

Can anybody know how to split an STL into surfaces in VTK? Or how to do it in Paraview?
Depends on how you want to split it. If you want to split it into grouped surfaces, use vtkPolyDataNormals with SplittingOn, and use SetFeatureAngle to decide what angle to split at. Then, you can use vtkPolyDataConnectivityFilter to get each split piece in a loop.
In ParaView :
Open ParaView
File -> Open -> Select your STL file, Apply
You obtain a single vtkPolyData object, you can then use ParaView for any splliting you may want to do.
In VTK :
vtkNew<vtkSTLReader> reader;
reader->SetFileName("/path/to/your/file.stl");
reader->Update()
You can the use reader output and show it or split it to your needs using VTK filters.

How to read a map into octave

This is a follow up to my post three weeks ago here How do I use m_map in octave, without really being a nuissance to kind and busy people. My problem is simply how does one overlay a basemap on an octave contour plot. After interpolating my irregularly spaced data (works for both contour lines and filled contours) I plot with the code:
contour(xi, yi, obsi, cstart:cstep:cend)
colorbar;
xlabel('Longitude'),ylabel('Latitude')
title('Mean Rain Onset')
saveas(gcf,'rainzam.pdf')
And I get
I have downloaded several map formats: ne_50m_admin_0_countries.zip, the apparently obsolete m_map (with associated tbase.Z, gshhg-bin-2.3.2.zip), soa.7z, world-bounds.7z, gshhg-gmt-2.3.2.tar.gz, dcw-gmt-1.1.1.tar.gz.
My question is has anyone used any of these maps in octave or gnuplot, and how to? I would appreciate any assistance.
Basically you have to load those maps in octave, they represent borders or coastlines with two variables (x,y) which you can then add to your plot with
hold on
plot(x,y)
That's the easy part, the hard part is to load the maps. All of them have different formats, which means it is a completely different story how to load them. For instance, the ne_50m_admin_0_countries.zip has a dbf format. Either you convert it first to ascii text and load it easily with the load function of octave or you need the OI package (http://wiki.octave.org/IO_package), which in turn demands java (http://wiki.octave.org/Java_package). I don't think this is the easy way for a newbie, so I suggest to convert the maps individually to text: google for "convert dbf to csv", "convert dbf to text", "convert dbf to ascii", etc... Perhaps some of those maps can be even loaded with excel and then saved as text (csv), the important issue is to convert them to text!
If you want to draw physical coastlines, you may download them from this link
https://www.naturalearthdata.com/downloads/
Then, after the drawing of a contour map of your own datas, you may add the coastlines using the following commands:
pkg load mapping
hold on
h = shapedraw ('FileName.shp','r','linewidth',1)

Make plots inside the WXMaxima GUI

How can I make the plots generated from plotting functions (like plot2d() lie inside the WXMaxima GUI rather than open new Windows? Someone made this in front of me, and I can't find out how he made that.
Thank you.
Just put a "wx" in front of your plot command: use wxplot, wxdraw, wxdraw2d or similar instead of plot, draw or draw2d.

Using reportlab to build PDF with vector-based graphs generated by matplotlib

I'm trying to build PDF-documents on the server-side in a Django-Installation using reportlab. These documents should contain several graphs which are to be created with matplotlib.
I already figured out how to make reportlab use matplotlib's images without dumping them to the filesystem temporarily by passing PIL-Image objects directly to the Image()-flowable. This works surprisingly well for rasterized images formats like PNG.
Now, the icing on the cake would be able to embed vector based graphics (like SVG).
I used svglib to convert SVGs generated by matplotlib to reportlab graphic objects but unfortunately svglib does omit the tickmarks and axis labels. On some graphs it fails in general.
Do you have any ideas?
This page has a solution that I haven't had a chance to test myself yet: https://web.archive.org/web/20120725125858/http://lateral.netmanagers.com.ar/weblog/posts/BB753.html
You can generate matplotlib graphics as pdf and use pdfrw to embed it in reportlab canvas as described in this answer

Resources