Tag Info

Hot answers tagged

8

After a rather long debugging session in our chat we could determine the reason of the problem and come up with a workaround. In short, we first tried whether the issue appears for the most basic Graphics[], which it didn't. As it turned out the gray background is introduced by using PlotLegends as in the example above. We went further by comparing ...


6

Although I do see a difference between the contents of bad.svg when I export with version 8.0.4 and 9.0.1, the svg is displayed in exactly the same way by Google Chrome. The display does indeed show a white background in Safari, though, when exported from Mathematica 8.0.4 on OS X. So we could now argue whether this is the fault of the browser, or the fault ...


5

one way: SetDirectory[NotebookDirectory[]]; fileName = "test.txt"; file = OpenWrite[fileName, PageWidth -> Infinity]; WriteString[file,"this is a string which will show up without the quotes"]; Close[file] To open for append and lines: SetDirectory[NotebookDirectory[]]; fileName = "AAA.txt"; file = OpenAppend[fileName, PageWidth -> ...


4

I think this is a bug rather than a feature. One way to accomplish this that will work in some scenarios without making a copy of the image is to use the crop tool, save the image and then undo the cropping thus restoring the original image.


4

Mathematica cannot export to Illustrator format. However, it can export both to PDF and EPS, which are natively supported by Illustrator. (In fact, I believe the AI format is based on PostScript too, just like EPS the AI format used to the based on EPS but is now based on PDF.) Try using PDF or EPS instead. The information on Jens's site will be useful ...


3

This has been fixed in version 10. Fonts are now correctly subsetted, even an OpenType font like Calluna, as shown here. The graphic was produced with the following code, and the resulting file size is just 11kb. test = Plot[{Sin[x], Cos[x]}, {x, 0, 5}, BaseStyle -> {FontFamily -> "Calluna Sans", FontSize -> 16}] Export["testcalluna.pdf", ...


3

So what you basically have to do is to take the head of the arrow only. I was a bit lazy to rebuild the Polygon myself so I looked for a .m file related to Arrow and found Arrow.m in /usr/local/Wolfram/Mathematica/8.0/AddOns/LegacyPackages/Graphics which contains approximately the following function makehead: makehead[len_, wid_, cent_] := Polygon@{{0, 0}, ...


3

One way would be to do the padding manually: padToWidth[width_, n_] := StringJoin@PadLeft[Characters@ToString[n], width, " "] newData = MapAt[padToWidth[4, #] &, data, {All, 1}]; (* Apply to first column *) newData = MapAt[padToWidth[3, #] &, newData, {All, 2}]; (* Apply to second column *) Export["data.dat", StringJoin[First@#, " ", Last@#] & ...


2

table = {{10, 2}, {3, 40}}; export = (Transpose@IntegerString@table)[[#]] /. a_String :> Table[" ", {# + 2 - StringLength@a}] <> a & /@ {1, 2} // Transpose; Export["file.dat", export, "Table"]


2

Rasterizing is a possibility: data = Notebook[{Cell[ BoxData[ToBoxes[ Rasterize[ Grid[{{11, 22}, {33, 44}}, Frame -> All, FrameStyle -> Directive[AbsoluteThickness[1], Orange]], ImageResolution -> 400](*end of Grid*)]]](*end of Cell*)}]; Export[FileNameJoin[{$TemporaryDirectory, "grid.pdf"}], data]; ...


2

I have no idea why Export is slow. The graph g = RandomGraph[DegreeGraphDistribution[Table[8, {10000}]]]; has 10k vertices, and 40k edges. On my machine, Timing[Export["g.col", g]] requires 10.822373 seconds. I wrote a very quick & naive function for writing the same graph to a file: WriteGraph[g_, filename_] := Module[{}, L = EdgeList[g]; ...


2

I cannot reproduce this problem on OS X with the current version of Mathematica (9.0.1). However, I think I remember a similar problem existing in some earlier versions of Mathematica, at least on Windows. If my memory is correct, a possible solution was to use one of the PDF printers (Acrobat Distiller, redmon, etc.) to print the notebook to PDF instead ...


2

Just for variety and to deal with ordering issues that some times arise with 1,10,2 by padding left with zeros. This assumes that plots contains list of graphics objects: MapThread[ Export["plot" <> #1 <> ".pdf", #2] &, {IntegerString[#, 10, 3] & /@ Range[Length@plots], plots}] File will be "plot001.pdf","plot002.pdf",etc


2

One way to do this is to Map and Export routine: plots = Table[Plot[Sin[a x], {x, 0, 4 Pi}], {a, 1, 10}] MapIndexed[Export[ToString[First@#2] <> ".png", #1] &, plots] This stores the files with names 1.png, 2.png, etc.


2

plots = Table[Plot[x, {x, -10, 10}], {t, 0, 10, 1}]; names = ToString@StringForm["~/Plot``.pdf", #] & /@ ToString /@ Range@Length@plots; Export[#1, #2] & @@@ Thread@{names, plots} Giving ten different plots exported in PDF.


2

DXF export is somewhat idiosyncratic (3D only) and slow. For the following I´ve reduced PlotPoints to make casual experimenting less glacial. The general idea is to extract all Line primitives and elevate coordinate tuples to 3D. LG3 = ContourPlot[ 1/2 - Sum[Sinc[(n \[Pi])/2] Cos[n (1 x + 4 ArcTan[y, x])], {n, 1, 200}] == 0.5, {x, -20, 20}, {y, -20, ...


2

The quotes appear because the InputForm does not show them, while the OutputForm does. Programmatically, you can explicitly call OutputForm to avoid this: Export["quotes.png", OutputForm[CharacterRange["a", "z"]]] You can also go into Format > Option inspector… and look for ShowStringCharacters and using Save selection as…:


2

The format isn't exactly the same, notably there is extra spacing, but this seems to work: ExportString[deployobj, "CDF"]


1

How about this? Grid[Prepend[ Flatten[Table[{a, b, Reverse@NMinimize[{a x + b y, 0.2 x + 0.1 y >= 14, 0.25 x + 0.6 y >= 30, 0.1 x + 0.15 y >= 10, x >= 0, y >= 0}, {x, y}]}, {a, 0, 3, 1}, {b, 0, 3, 1}] /. {ap_, bp_, {{x -> xp_, y -> yp_}, axbyp_}} :> {ap, bp, xp, yp, axbyp}, 1], {"a", "b", "x", ...


1

I'm not sure exactly what you want, but in an effort to demonstrate some possibilities: Join @@ Table[{{a, b}, NMinimize[{a x + b y, 0.2 x + 0.1 y >= 14, 0.25 x + 0.6 y >= 30, 0.1 x + 0.15 y >= 10, x >= 0, y >= 0}, {x, y}][[2]]}, {a, 0, 3, 1}, {b, 0, 3, 1}] // Column Or: Join @@ Table[{{HoldForm[a] -> a, HoldForm[b] -> ...


1

I'm on 10.0 for Mac OS X x86 (64-bit) (June 29, 2014) and and have the following observed: highlighting the Output-Cell and using the Command "Save Selection As" leads to the following result; highlighting the Output and using the Command "Save Selection As" leads to the observed result; Wile CellPrint[ExpressionCell[CharacterRange["a", ...


1

With V10 on OS X, I get Might be a platform issue.


1

Addressing the comment, WriteString can take multiple arguments to write multiple expressions so you can do: WriteString[file, "string" , "\n" ] which may be somewhat more convenient than concatenating the "\n" to the string. If you want to write a list of strings adding linebreaks you can do like this: WriteString[f, Sequence @@ ...


1

It seems that the described method does work in v.10.0.0 if the image is represented as Graphics object. To convert Image to Graphics one can use Show. The reason why Graphics works is that the soft crop explicitly sets new PlotRange what can be seen by applying Options to the cropped image. But in the case of Image the PlotRange option exists only inside ...


1

I have successfully exported many 3D Mathematica objects in the .stl format (used for 3D printing). I use Cheetah3D on the Mac (now $69) to work with the object, add axes or colors, then export as a .dae for use in Collada environments like iBooks Author. Maybe Google Sketchup would also work; it has Collada as a native format but not sure what it imports. ...


1

Correct it to be: Export["file.xls",{{2,5},{5,7}}] or more explicitly Export["file.xls",{{2,5},{5,7}},"XLS"] "Table" is a generic Table-Format, suitable for a simple Text-Editor, not specially dedicated to Excel When you leave away the 3rd argument, then the default value is "XLS", and Excel will import it without additional Import-Dialog.


1

Since you mentioned squished axes values when using GraphicsGrid, you can use a combination of ImageSize and BaseStyle--along numerous options to tweak plots and graphics, more info here--within LogLogPlot to achieve the look you want (I haven't experimented with it much but I found font size at 1/20 of image size looks decent). You can also specify the ...


1

a = Plot[Sin[x], {x, -Pi, Pi}]; Export["C:\\YourPath\\plot.pdf", a]


1

For this answer, I accept no praise. All positive remarks toll @Jens. This link shows us a fantastic strategy (see Section: Exporting 3D graphics as PDF/EPS). just include ... as part of the Prolog: Map[SetOptions[#, Prolog -> {{EdgeForm[], Texture[{{{0, 0, 0, 0}}}], Polygon[#, VertexTextureCoordinates -> #] &[{{0, 0}, {1, ...


1

You could extract adjacency matrix and export it. g = RandomGraph[DegreeGraphDistribution[Table[8, {10000}]]]; Export["g.col", AdjacencyMatrix[g]] It will ignore vertex names, but it's not supported in DIMAC any way.



Only top voted, non community-wiki answers of a minimum length are eligible