Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Convert Graphics3D to Graphics2D. Is it possible?

828 views
Skip to first unread message

Alexey

unread,
Oct 10, 2009, 7:11:21 AM10/10/09
to
Hello,
My aim is to produce vector-quality 2D representation of Graphics3D
for publication purposes. I would wish to have a general solution but
if it is impossible in the new version of Mathematica I should
consider only my particular case. My Graphics3D consists of a smooth
line representing the solution of a system of differential equations
(and axes, of course). So it seems to be a simple case. Is it possible
to convert this 3D graphics in 2D format preserving text as text (not
converting text in vector lines)?

As an suitable example one may use Graphics3D generated by
ParametricPlot3D[{Cos[\[Theta]], Sin[\[Theta]],
Sqrt[\[Theta]]}, {\[Theta], 0, 6 Pi}]

Patrick Scheibe

unread,
Oct 11, 2009, 8:05:53 AM10/11/09
to
Hi,

when you export the graphics to pdf, eps, svg or even to the windows emf
the graphics is stored as vector-graphics and the text is preserved.

Cheers
Patrick

David Park

unread,
Oct 11, 2009, 6:04:38 PM10/11/09
to
Why isn't the regular output suitable for publication? It is a 2D image.

You could get higher quality by using the options MaxRecursions first, and
then PlotPoints if necessary. The only thing about the plot example you give
is that there are too many ticks for the purpose. You could remedy that by
using custom ticks.

Otherwise, I don't see why ordinary Mathematica graphics output isn't good
enough for publication. I think people use it all the time.


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/

Alexey

unread,
Oct 12, 2009, 7:22:12 AM10/12/09
to
On 12 Oct, 02:04, "David Park" <djm...@comcast.net > wrote:
> Why isn't the regular output suitable for publication? It is a 2D image.

I would like to have a Mathematica's Graphics2D-representation for
having an ability to modify 2D-projections of 3D-objects. In my
particular case, the curve to plot is very complex and I need extra
large set of points for having the right representation. The generated
vector plot has size tens megabytes. I would want to optimize the
number of points in 2D-projection rather than in 3D because it is much
more straightforward and simpler.

Alexei Boulbitch

unread,
Oct 13, 2009, 7:18:13 AM10/13/09
to
Lesha,

if I understand you right, you need a 2D projection of your 3D curve, do you? Then why not to try this or alike:

ParametricPlot[{Cos[\[Theta]], Sqrt[\[Theta]]}, {\[Theta], 0, 6 Pi}]
ParametricPlot[{Sin[\[Theta]], Sqrt[\[Theta]]}, {\[Theta], 0, 6 Pi}]

??

However, if not to answer your question literally, you seem to be ready to report your result as a paper in a journal.
May be you know all this, then excuse me. If not, a good idea might be to draw a more simple curve that is
not your solution and has less points in it, but looks pretty like that and allows to qualitatively discuss
all you need. You may then show some important fragments of the solution either separately, or as insets in the same graph.

It may be not the case, if for instance, you need to show a phase portrait with a lot of trajectories, e.g. to show the whole
solution is inevitable, if you do not want to draw it by hand. The image however, appears to be too large even to
be sent by e-mail. When I met such a problem myself, I exported (or simply Copy-Pasted) my heavy image into Adobe
Illustrator and then saved it into say, jpg file with the medium or low quality.
This enabled me to considerably decrease the size of the image. The result may be then saved into the format required by
the journal of your choice.

Have success, Alexei

--
Alexei Boulbitch, Dr., habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax: +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.

gigabi...@brockeng.com

unread,
Oct 13, 2009, 7:19:10 AM10/13/09
to
On Oct 12, 7:22 am, Alexey <lehi...@gmail.com> wrote:
> On 12 Oct, 02:04, "David Park" <djmp...@comcast.net > wrote:
>
> > Why isn't the regular output suitable for publication? It is a 2D image=

.
>
> I would like to have a Mathematica's Graphics2D-representation for
> having an ability to modify 2D-projections of 3D-objects. In my
> particular case, the curve to plot is very complex and I need extra
> large set of points for having the right representation. The generated
> vector plot has size tens megabytes. I would want to optimize the
> number of points in 2D-projection rather than in 3D because it is much
> more straightforward and simpler.

(* To sneak up on what you want to do, look at the FullForm of the
original plot *)

pp = ParametricPlot3D[{Cos[\[Theta]], Sin[\[Theta]],


Sqrt[\[Theta]]}, {\[Theta], 0, 6 Pi}]

pp // FullForm

(* If you pick apart the contents by brute force, you can recognize
the plot Line as pp[[1, 1, 3, 2]] , and indeed, you can display Line,
stripped of Options and color, as: *)

Graphics3D[pp[[1, 1, 3, 2]]]

(* Then you can design and display arbitrary 3D manipulations or 2D
projections, picking out the node coordinates, replacing them with
patterns of your own design, adding back in the Options or text you
need.. *)

Graphics3D[First[pp]/.{x_Real,y_Real,z_Real}:>{x,y,-z}]
Graphics[First[pp] /. {x_Real, y_Real, z_Real} :> {x, y + 0.5 z}]

(*
Hope this helps,
Fred Klingener
*)

Szabolcs Horvát

unread,
Oct 13, 2009, 7:24:31 AM10/13/09
to

If my memory serves me right, in versions <= 5 this used to be possible
by wrapping the Graphics3D[] object in Graphics[].

In versions >= 6 it is not possible anymore. It is possible to export
to PDF and then re-import, which will give you a 2D representation that
is quite large and difficult to work with.

I usually export complicated 3D graphics as high resolution bitmaps
rather than vector images. This results in smaller size and more
consistent quality when viewed on screen.

Alexey

unread,
Oct 13, 2009, 11:18:42 PM10/13/09
to
On 13 Oct, 15:24, Szabolcs Horv=E1t <szhor...@gmail.com> wrote:
> If my memory serves me right, in versions <= 5 this used to be possible
> by wrapping the Graphics3D[] object in Graphics[].
>
> In versions >= 6 it is not possible anymore.

You are right, thank you for this note. This functionality in v.5 is
exactly what I need. It works perfect in v.5 but in v.6 and v.7 such
functionality is absent and this means that I should go back to v.5
which does not take advantages of new graphics capabilities of version
7.

> It is possible to export
> to PDF and then re-import, which will give you a 2D representation that
> is quite large and difficult to work with.

You are right.

> I usually export complicated 3D graphics as high resolution bitmaps
> rather than vector images. This results in smaller size and more
> consistent quality when viewed on screen.

In really it is possible (and it is not too difficult) to optimize the
number of points in the 2D-projection of complex 3D-line plot and such
vector graphics will have size in 3-20 kilobytes - much less than
bitmap and of high quality! But it is really simple only inside
Mathematica and having real 2D-projection of all points AND axes with
ticks and labels... The latter is problem in v.6 and v.7 but in v.5
all of this is created automatically. The lack of such functionality
in v.>=6 is painful.

Szabolcs Horvát

unread,
Oct 13, 2009, 11:26:37 PM10/13/09
to
On 2009.10.12. 13:22, Alexey wrote:

If my memory serves me right, in versions <= 5 this used to be possible

by wrapping the Graphics3D[] object in Graphics[].

In versions >= 6 it is not possible anymore. It is possible to export

to PDF and then re-import, which will give you a 2D representation that
is quite large and difficult to work with.

I usually export complicated 3D graphics as high resolution bitmaps

dr DanW

unread,
Oct 13, 2009, 11:26:48 PM10/13/09
to
I had thought that you could use FullGraphics to get the coordinates
of axes lines and tick marks, then write a function to project the
coordinates of the function points, axes, tick marks, etc, onto a
plane and redraw as 2D graphics. Alas, FullGraphics does not work on
Graphics3D objects. Perhaps there is another way to crack into the
underlying OpenGL structure, but I cannot find it.

You may have to work with bitmaps. It is my understanding that
publishers like to work with large TIFF files anyway (memory is no
object to them.)

Daniel

van der Burgt, Maarten

unread,
Oct 14, 2009, 7:56:32 AM10/14/09
to
Alexey,


Is this something which could help?

pp = ParametricPlot3D[{Cos[\[Theta]], Sin[\[Theta]],
Sqrt[\[Theta]]}, {\[Theta], 0, 6 Pi}]

m = RotationMatrix[\[Theta], {{0, 0, 1}, {0, 1, 0}}] /. \[Theta] ->
75 Degree;

pp[[1, 1, 3, 2]] /. {{x_, y_, z_} -> {(m.{x, y, z})[[1]], (m.{x, y,
z})[[2]]}};
Graphics[{Blue, %}, Axes -> True]

pp[[1, 1, 3, 2]] is the Line[] object containing the 3D points.

Best regards,

Maarten

-----Original Message-----
From: Alexey [mailto:leh...@gmail.com]
Sent: Saturday, 10 October, 2009 13:11
Subject: Convert Graphics3D to Graphics2D. Is it possible?

Hello,
My aim is to produce vector-quality 2D representation of Graphics3D
for publication purposes. I would wish to have a general solution but
if it is impossible in the new version of Mathematica I should
consider only my particular case. My Graphics3D consists of a smooth
line representing the solution of a system of differential equations
(and axes, of course). So it seems to be a simple case. Is it possible
to convert this 3D graphics in 2D format preserving text as text (not
converting text in vector lines)?

As an suitable example one may use Graphics3D generated by

Alexey Popkov

unread,
Oct 14, 2009, 7:57:36 AM10/14/09
to
Thank you for short code of 2D projection of the line. But this is only the
part of problem. The real problem is that I need the full set of axes, ticks
and labels projected to 2D. This is stumbling block.

Alexey

unread,
Oct 14, 2009, 7:58:30 AM10/14/09
to
On 13 Oct, 15:18, Alexei Boulbitch <Alexei.Boulbi...@iee.lu> wrote:
> Lesha,
>
> if I understand you right, you need a 2D projection of your 3D curve, do you? Then why not to try this or alike:

Not only 2D projection of the curve but also 2D projection of the
axes, ticks and labels. In v.5 all of this is created automatically by
wrapping the Graphics3D[] object in Graphics[]. Such functionality is
something I miss in v.7.

Tim Kostka

unread,
Oct 14, 2009, 8:02:14 AM10/14/09
to
What I have been doing is using a combination of Rasterize and Magnify to
get the desired dimensions, then export the image as a PNG. For example:
plot=ParametricPlot3D[{Cos[\[Theta]], Sin[\[Theta]], Sqrt[\[Theta]]},

{\[Theta], 0, 6 Pi}]
image=Rasterize[Magnify[plot,2]]
Export["image.png",image]

Change the magnification as needed to get the desired dpi setting.

I realize this is not a vector graphic, but the resulting image is
reasonable in size and is very flexible to work with.

Regards,
Tim Kostka

0 new messages