New answers tagged

3

Set ImagePadding option to None. (With None the exported image is cut a bit on the y-axis so use 10 instead of None) Plot[(180 Sqrt[\[Pi]^2 - 625 t] (\[Pi]^2 (-25 + 36 t) - 1500 t (-15 + 45 t -Sqrt[-\[Pi]^2 + 900 t])))/(\[Pi]^4 Sqrt[-\[Pi]^2 + 2500 t]) + Tan[2 Sqrt[\[Pi]^2 - 625 t]], {t, 0.01, 0.016}, AxesStyle -> {{Directive[Red, 12], ...


11

You must use opts : OptionsPattern[] and not opts_ : OptionsPattern[]. The : character has a double role: it can indicate a pattern name or an optional argument. If the left-hand-side is a symbol then it indicates a pattern name, otherwise it indicates an optional argument. Examples: a_ is a Blank named a. a : _ is a blank named a using : syntax. a_ : ...


7

To whom it may concern, a workaround: path = FileNameJoin[{$HomeDirectory, "Desktop", "testWorking.nb"}]; nb = Notebook[{}, Saveable -> False, NotebookEventActions -> {{"MenuCommand", "Save"} :> {}} (*the fix*) ]; Export[path, nb, "NB"]


1

According to the Documentation, you should set CellLabelAutoDelete -> False for making cell labels permanent: Create a notebook with the setting CellLabelAutoDelete -> False: nb = CreateDocument[{ExpressionCell[Defer[1 + 1], "Input"], ExpressionCell[Defer[2 + 2], "Input"]}, CellLabelAutoDelete -> False] When inputs are evaluated, ...


0

"In/Out" labels are created, roughly, when you evaluate/create cells. And according to CellLabelAutoDelete documentation: If you edit a previously evaluated input cell, its cell label is cleared That's what is happening when you paste copied image. A default cell is created, with a label, but then the cell is edited by pasting your image. This clears ...


2

I don't think it's possible to extract such information from an already evaluated plot. Plot returns a Graphics object and very little meta-information is stored. We can see this by inspecting with InputForm. InputForm[Plot[1, {x, 0, 1}, ColorFunction -> Hue, PlotPoints -> 2]] Graphics[{GraphicsComplex[{{1.*^-6, 1.}, {0.999999, 1.}, {0.5, 1.}}, ...


4

This doesn't allow the extraction and reconstruction of the unknown ColorFunction, but it does allow to override it with an exact duplicate that is transparent, plt1 = Plot[Sin[x], {x, 0, 2 Pi}, ColorFunction -> (#^2 &), ImageSize -> 300]; plt2 = Plot[Sin[x], {x, 0, 2 Pi}, ColorFunction -> (Hue[#^2] &), ImageSize -> 300]; plt3 = ...


2

InitializationGroup vs group of InitializationCells If you create a new cell in an InitializationGroup it will automatically become an InitializationCell. For the group of InitializationCells you will get a default one, which you can turn into another InitializationCell or not. A set of InitializationCells vs one InitializationCell. I can't find any ...


4

There is a straightforward way to set CellMargins to be zero: DialogInput[ DialogNotebook[{ExpressionCell[Pane[RandomImage[], ImageMargins -> 8], CellMargins -> 0]}]] Instead of ImageMargins we can rely on CellFrameMargins: DialogInput[ DialogNotebook[{ExpressionCell[RandomImage[], CellMargins -> 0, CellFrameMargins -> 8, ...


3

I gave up looking for neat solution. Here's brute force. Since the bottom CellMargins are not respected then let's not use any! :) We can use Pane and its ImageMargins to take control over padding. DialogInput[ DynamicModule[{}, Pane[RandomImage[], ImageMargins -> 8], Initialization :> (SetOptions[EvaluationCell[], CellMargins -> ...


2

It really expects that you have some buttons along the bottom. DialogInput[Column[{Pane @ RandomImage[], Button["OK", DialogReturn[0]]}]] but you can do it this way DialogInput[Column[{Pane @ RandomImage[], ""}]] Update I Think it looks better with the bottom margin a bit larger than the top, but if you are being picky about equal margins, try ...


3

This is one aspect of a classic problem: Plot is HoldAll. So, moreProp is not being evaluated. I think the most effective way to work around this is to use With (cf. this question) to inject the values into Plot, e.g. newPlot[func_, range_, prop___] := With[{mp = moreProp}, Plot[func, range, prop, mp]] Then, it works: Alternatively, you can use ...



Top 50 recent answers are included