Newest questions tagged coordinate - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-18T14:20:51Z https://mathematica.stackexchange.com/feeds/tag?tagnames=coordinate&sort=newest https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/199998 1 Plot Using User-defined Coordinates Histoscienology https://mathematica.stackexchange.com/users/54993 2019-06-09T01:19:35Z 2019-08-16T21:28:17Z <p>Suppose instead of using Cartesian coordinate <span class="math-container">$\vec{x}=(1, 0)$</span> and <span class="math-container">$\vec{y}=(0, 1)$</span>, I want to define new coordiates <span class="math-container">$\vec{a} = (1,0)$</span> and <span class="math-container">$\vec{b} = (\frac{1}{2},\frac{\sqrt{3}}{2} )$</span>. And when I plot a function for example <span class="math-container">$f(\vec{r}) = f(c, d)$</span></p> <blockquote> <p>f[c_, d_] := d</p> <p>Plot3D[f[c, d], {c, 0, 1}, {d, 0, 1}]</p> </blockquote> <p>Is there a way it will interpret the plotting region and function as <span class="math-container">$d*\vec{b}$</span> instead of <span class="math-container">$d*\vec{y}$</span>?</p> <p>I know I can probably redefine the new unit vectors <span class="math-container">$\vec{a}$</span> and <span class="math-container">$\vec{b}$</span> as Cartesian coordinate but it would be convenient if I can redefine the coordinate system. </p> <p>I hope I'm clear enough what I'm trying to do and thanks in advnace!</p> https://mathematica.stackexchange.com/q/199959 2 How to make a polygon centered at {0,0} with scaled dimensions? nanjun https://mathematica.stackexchange.com/users/44439 2019-06-07T19:32:45Z 2019-06-09T12:02:04Z <p>I am making a customized plot marker <code>mk2</code> (a black star) with <code>Polygon</code>. Another marker <code>mk1</code> (a red circle) I made with <code>Circle</code> is properly centered. However, I could not figure out how to make <code>mk2</code> centered at <code>{0,0}</code> so I can use it later to mark properly some data points without shifting. Here is the code:</p> <pre><code>mk1 = {AbsoluteThickness[1.5], Red, Circle[{0, 0}, Scaled[0.02]]} // Graphics l = 1/50; k = 1/150; mk2 = Polygon[ Scaled /@ {{l, 0}, {k, k}, {0, l}, {-k, k}, {-l, 0}, {-k, -k}, {0, -l}, {k, -k}}] // Graphics Show[mk2, mk1, Axes -&gt; True] </code></pre> <p><a href="https://i.stack.imgur.com/dOWso.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dOWso.png" alt="enter image description here"></a></p> <p>The coordinates of <code>mk2</code> need to be given in <code>Scaled</code> numbers. How can I make <code>mk2</code> also centered at <code>{0,0}</code>?</p> https://mathematica.stackexchange.com/q/199154 2 Code for the elementary $m\times m$ matrix $E_{ij}$ Mee Seong Im https://mathematica.stackexchange.com/users/62412 2019-05-27T00:32:23Z 2019-05-27T01:52:15Z <p>Let <span class="math-container">$E_{ij}$</span> be an <span class="math-container">$m\times m$</span> matrix with a <span class="math-container">$1$</span> in the <span class="math-container">$(i,j)$</span>-entry and zero otherwise.</p> <p><code>DiagonalMatrix[{1},j,m]</code> will put a <span class="math-container">$1$</span> in the first row along the <span class="math-container">$j$</span>-th super-diagonal in an <span class="math-container">$m\times m$</span> matrix, and <span class="math-container">$0$</span> elsewhere. That is, this is the code for <span class="math-container">$E_{1,j}$</span>. </p> <p>I'm trying to write a code for <span class="math-container">$E_{ij}$</span>, so <code>{1}</code> in <code>DiagonalMatrix</code> should be replaced with the tuple <code>{0,...,0,1,0,...,0}</code> of length <span class="math-container">$m-j$</span>, where we put the <span class="math-container">$1$</span> in the <span class="math-container">$i$</span>-th <span class="math-container">$\textit{component}$</span>.</p> <p>Note that Mathematica treats the notation <code>{0,...,0,1,0,...,0}</code> as a column vector.</p> https://mathematica.stackexchange.com/q/198521 5 How to scale and shift the coordinates of a Graphics object? nanjun https://mathematica.stackexchange.com/users/44439 2019-05-16T19:38:49Z 2019-05-17T03:57:25Z <p>I am trying to overlap two <code>Graphics</code> objects <code>g1</code> and <code>g2</code> with <code>Show</code>. However, I found that when the coordinates of each object is defined to quite different ranges, I need to "scale" and "shift" the coordinates of one object to get the desired look. </p> <p>For example,</p> <pre><code>g1 = Graphics[{GrayLevel[0.8], Rectangle[{-2, -2}, {2, 2}]}]; g2 = Graphics[{{GrayLevel[0.5], Rectangle[{0, 0}, {1, 1}]}}]; Show[g1, AspectRatio -&gt; 1, Axes -&gt; True, ImageSize -&gt; 230] Show[g2, AspectRatio -&gt; 1, Axes -&gt; True, ImageSize -&gt; 230] Show[g1, g2, AspectRatio -&gt; 1, Axes -&gt; True, ImageSize -&gt; 230] </code></pre> <p>The overlapped version of <code>g1</code> and <code>g2</code> looks like this <a href="https://i.stack.imgur.com/tVM01.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tVM01.png" alt="enter image description here"></a></p> <p>However, I would like to scale the coordinates of <code>g2</code> to make <code>g2</code> twice large and also shift its coordinates so the center can "roughly" coincide the center of <code>g1</code>. I say "roughly" because <code>g1</code> and <code>g2</code> may be some graphics not of a regular shape. The desired result will look like <a href="https://i.stack.imgur.com/VO3jM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VO3jM.png" alt="enter image description here"></a></p> <p>So how can I manipulate the coordinates of <code>g2</code> to adjust its relative position and size when <code>Show</code> with <code>g1</code>? Please avoid modifying the definition of <code>g1</code> and <code>g2</code> as they can be any <code>Graphics</code> copy-pasted over.</p>