Export 3d plot (e.g. from plotly) to an STL file? - python-3.x

I am wondering if there is a method to export a 3-d plot object, for example generated using plotly, to an STL file (for 3d printing)? Plotly allows these types of volume plots to be exported as PDFs or HTML files (the HTML files are interactive).
I looked to see if plotly has a component which allows exporting to STL files. I did not find anything like that.

Related

Is it possible to draw paths or import LineString placemarks from a KML file and display in Qlik Sense maps?

I've several KML files with several paths as LineString placemarks which I would like to plot in Qlik Sense maps. I've tried to load the KML file directly, but Qlik Sense doesn't recognize any LineString placemark (only points and polygons).
Is there any some way to display those paths on Qlik Sense?
There is a video guide on using maps in Qlik Sense that specifically refers to KML files here

Gnuplot plot visualization inside paraview 2D view

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.

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)

Save a drawing made by OCaml graphics in a EPS and PDF file

I made an OCaml program that draws L-systems using the turtle interpretation.
What I'm looking for is to save what I draw with graphics to an image of EPS and PDF file.
But I never done this before and I don't know how to do, so I've looked in graphics librairy and all I've found is get_image to get an Image file and dump_image to get an matrix color from an Image file but from here I don't know how to save the data into a EPS or PDF file.
Does anybody have an idea about how to do that?
I never used it, but there is graphicspdf which implements the Graphics interface but outputs to PDF (opam install graphicspdf). Similar for postscript is GraphPS (not packaged in opam).
Alternatively if you program is well designed you should be able to render to multiple backends. In that case Vg allows you to render to PDF, SVG or the html canvas (opam install vg). There is also ocaml-cairo that provides you bindings to the C library libcairo and allows you to render to multiple rendering backends (opam install cairo).

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