Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.maple > #798
| Newsgroups | comp.soft-sys.math.maple |
|---|---|
| Date | 2013-07-19 22:40 -0700 |
| References | <krr2rb$1aj$1@speranza.aioe.org> |
| Message-ID | <9ecf172f-3546-41f8-8ba4-5c13d2b8d7c3@googlegroups.com> (permalink) |
| Subject | Re: How to export an expression as an image? |
| From | acer <maple@rogers.com> |
Le samedi 13 juillet 2013 04:24:11 UTC-4, Nasser M. Abbasi a écrit :
> Is it possible in Maple to export any expression as an image?
>
>
>
> For example, I'd like to export the result of dsolve() to a .png
>
> file so I can include that later in another document. I want to
>
> do this programmatically.
>
>
>
> For example:
>
>
>
> --------------------------------
>
> ode[1] := diff(y(x),x) - (a4*x^4+a3*x^3+a2*x^2+a1*x+a0)^(-1/2):
>
> dsolve(ode[1]=0,y(x));
>
> ---------------------------------
>
>
>
> Now I'd like to export the solution, as shown in the display as png file.
>
>
>
> For example, in Mathematica, I would do
>
>
>
> --------------------------------
>
> DSolve[D[y[x], x] - (a4*x^4 + a3*x^3 + a2*x^2 + a1*x + a0)^(-1/2) ==0, y[x], x]
>
> Export["foo.png", %]
>
> -------------------------------
>
>
>
> And that will save the last output to foo.png as an image. Or I can
>
> say r=.....; then Export["foo.png",r];
>
>
>
> Is it possible to do this in Maple? I am using Maple 17
>
>
>
> thanks
>
> --Nasser
You could try typesetting your expression in a textplot, displaying that without axes, and exporting to an image file format using the `plotsetup` command. Below is a simple (crude) procedure to do that.
It might require a tweaking to get the font size, image width, and plot view correct. Those might need to depend upon the expression. (You might even have to change it to have the plot view be passed as argument...)
You mentioned .png and you also mentioned `plotsetup`. I suppose that you have realized that the *programmatic* plot drivers do not suppport .png export. See the ?plotdevices help-page, which is linked from the ?plotsetup help-page.
Export to .png is provided by the GUI itself, eg. by right-click content menu, which you do not want to do for each of your many expressions.
As suggested by others, you could alternatively have all the expressions as outputs in a single worksheet which you export to a combination of .html/.gif with just a single mouse action.
restart:
exportexpression:=proc( ee, filenm::string,
{width::posint:=640},
{fontsize::posint:=11} )
uses plots;
plotsetup('jpeg','plotoutput'=filenm,
'plotoptions'=cat("width=",width));
print(display(textplot([0,0,typeset(ee)],
'font'=["times","roman",fontsize]),
'axes'='none',
'view'=-0.5..0.5,'scaling'='constrained'));
fclose(filenm):
plotsetup('default');
NULL;
end proc:
ode[1] := diff(y(x),x) - (a4*x^4+a3*x^3+a2*x^2+a1*x+a0)^(-1/2):
r:=dsolve(ode[1]=0,y(x));
fn:=cat(kernelopts(homedir),"/eqnexprt.jpg");
exportexpression( r, fn, width=320, fontsize=12 );
Back to comp.soft-sys.math.maple | Previous | Next — Previous in thread | Find similar | Unroll thread
How to export an expression as an image? "Nasser M. Abbasi" <nma@12000.org> - 2013-07-13 03:24 -0500
Re: How to export an expression as an image? A N Niel <anniel@nym.alias.net.invalid> - 2013-07-13 07:47 -0600
Re: How to export an expression as an image? "Nasser M. Abbasi" <nma@12000.org> - 2013-07-13 14:08 -0500
Re: How to export an expression as an image? Axel Vogt <&noreply@axelvogt.de> - 2013-07-13 19:50 +0200
Re: How to export an expression as an image? "Nasser M. Abbasi" <nma@12000.org> - 2013-07-13 14:11 -0500
Re: How to export an expression as an image? "Nasser M. Abbasi" <nma@12000.org> - 2013-07-13 15:25 -0500
classical interface / Re: How to export an expression as an image? Axel Vogt <&noreply@axelvogt.de> - 2013-07-13 22:52 +0200
Re: classical interface / Re: How to export an expression as an image? "Nasser M. Abbasi" <nma@12000.org> - 2013-07-13 17:28 -0500
Re: classical interface / Re: How to export an expression as an image? Axel Vogt <&noreply@axelvogt.de> - 2013-07-14 09:00 +0200
Re: classical interface / Re: How to export an expression as an image? "Nasser M. Abbasi" <nma@12000.org> - 2013-07-14 02:23 -0500
Re: classical interface / Re: How to export an expression as an image? Axel Vogt <&noreply@axelvogt.de> - 2013-07-14 15:43 +0200
Re: How to export an expression as an image? acer <maple@rogers.com> - 2013-07-19 22:40 -0700
csiph-web