Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions on the construction of 2D and 3D graphics through the direct use of primitives, directives, and functions. Include the graphics3d tag for questions specifically on 3D graphics. This tag is not to be used for basic questions on visualizing functions and lists using the various flavors of Plot commands.
2
votes
Evaluation of Graphics3D transforms
You could use my NormalizeGraphics function for this:
NormalizeGraphics @ Graphics3D[Translate[Sphere[{0,0,0}],{1,0,0}]] //InputForm
Graphics3D[Sphere[{1, 0, 0}, 1]]
7
votes
Accepted
How to use graphic objects as (scalable) plot labels
edited to paint over axis below barcodes
makeInset[i_,n_] := Inset[
Graphics[barcode[i]],
Scaled[{-0.02,0},{0,i}],
{0,0},
Scaled[{3.6,1}/n]
];
bplot[data_] := With[{n = Length[data]}, …
3
votes
Accepted
GraphicsColumn holding image width constant
To have plots with the same width in a GraphicsColumn, they need to use the same ImagePadding and ImageSize specs. For example:
GraphicsColumn[{
Plot[Sin[x], {x, 0, 1}, ImagePadding->30, ImageSiz …
10
votes
Accepted
Create a 2D pin plot
I think you could use DiscretePlot:
DiscretePlot[n^1.2, {n, 10}, AxesOrigin->{0,0}]
DiscretePlot[Cos[n], {n,10}, AxesOrigin->{0,0}]
9
votes
Accepted
How to plot the graphics within a prescribed domain?
Use Texture:
Graphics[
{
Texture[Graphics[{smalls}, PlotRange->{{-10,10},{-10,10}}]],
EdgeForm[Black],
Polygon[
CirclePoints[{0,0}, 10, 120],
VertexTextureCoordinates - … Use ImageMultiply:
ImageMultiply[
Graphics[smalls, PlotRange->{{-10,10},{-10,10}}],
Graphics[{White, EdgeForm[Black], Disk[{0,0},10]}, Background->None]
]
(Addendum)
$3$. …
2
votes
Why VertexColors decreases the smoothness of lines?
How about:
Show[
Graphics[
Polygon[
{{0,0},{1,0},{1,1},{0,1}},
VertexColors->{Opacity[0,Red],Opacity[1,Red],Opacity[1,Red],Opacity[0,Red]}
]
],
Graphics …
3
votes
What is the best way to clip a graphic to a region?
The output if not always a graphics primitive. Sometimes the output of RegionIntersection is a BooleanRegion object, and these objects don't render inside of Graphics. … This can be fixed by using BoundaryDiscretizeRegion to convert to a BoundaryMeshRegion that does render inside of Graphics (in M12). …
5
votes
Creating new graphics primitive (EdgeForm, FaceForm)
In Mathematica 12 BoundaryMeshRegion objects can be used as a Graphics primitive. So, another idea is to use a BoundaryMeshRegion as your primitive. … b_BooleanRegion :> BoundaryDiscretizeRegion[b]
]
},
Typeset`MakeBoxes[new, form, Graphics]
]
Examples:
Graphics[{Pink, EdgeForm[Blue], CutoutEllipse[{0,0}, {4,2}, .9 {1,2}]}]
Graphics …
4
votes
How can one "shorten" arrows to be drawn between two points but being a bit hemmed in, as no...
You can use the undocumented functions DynamicLocation and and DynamicName to do this (see this answer for more details):
Graphics[
{
Arrowheads[{-Medium,Medium}],
Arrow[{
DynamicLocation …
8
votes
Graphics dimensions (imprecise `PlotRange` function)
You can use the ResourceFunction "GraphicsInformation" for this purpose:
SeedRandom[1];
g = Graphics[{
Table[
Circle[RandomReal[{-10,10},2],RandomReal[{0,10},2],RandomReal[{0,2 π},2]], …
9
votes
Converting a RawBoxes object to a workable expression
You can use ToExpression to turn a box expression into a normal expression. However, ToExpression doesn't work with RawBoxes, Cell or BoxData. So, the following might work for you:
rawBoxesToExpressio …
10
votes
Accepted
Application of Options for Graphics
The documentation says:
Nested lists of graphics constructs can be given. Directive specifications such as GrayLevel remain in effect only until the end of the list that contains them. … So, include Dashed and the first circle in a nested list:
Graphics[{Green, {Dashed, Circle[{0, 0}, .4]}, Black, Circle[{0, 0}, .5],
FaceForm[], EdgeForm[Black], Rectangle[{-1, -1}, {1, 1}]}] …
15
votes
How do I add arrowheads to circular arcs?
You can use the ResourceFunction "SplineCurve" to do this:
Show[
Graphics[{
Red,
Arrowheads[{-.05,.05}],
Arrow @ ResourceFunction["SplineCircle"][{0,0}, 1, {1, 0}, {0 Degree … , 90 Degree}]
}],
Graphics[{
Blue,
Arrowheads[{-.05,.05}],
Arrow @ ResourceFunction["SplineCircle"][{0,0}, 1.25, {1, 0}, {0 Degree, 270 Degree}]
}],
Graphics[{ …
23
votes
Accepted
Retrieving the ImagePadding in absolute units
It is possible to use a single call to ExportPacket to extract graphics information from multiple graphics objects. … Since the call to ExportPacket is the most time consuming part of the code, using a single call to ExportPacket will be much quicker than using graphicsInformation on multiple Graphics objects. …
7
votes
Accepted
Determine the PlotRange of a Graphics object programmatically
For instance, compare:
PlotRange[Graphics[{}, Axes->True]]
"PlotRange" /. GraphicsInformation[Graphics[{}, Axes->True]]
{{0., 1.}, {0., 1.}}
{{-1.04167, 1.04167}, {-1.04, 1.04}} …