Why did I get a different result-plot between the two solutions? - fluid-dynamics

>
Hi,
I'm using a sample problem to learn the comsol.
I would like to let my case problem (left)
3D plot, be the same as the tutorial plot (right).
My problem is that, instead of the right figure plot (that shows the resin-red color traveling from the left edge to the right one), I'm getting the nonconforming left one.
Do you have an idea if there is a choice of getting the right plot, or an advice about why I get the left plot instead of the right?
Thank you in advance!
Panos Deemac

Your problem is the Colorbar. In the left the color goes up to 1x10^5 while in the right it goes to 1, thus drawing as red everything above 1. Change the color limits to the same, and you'll get the same plot.

Related

How do I graph a line in Julia with an arrow on both sides?

Here is my code:
using MTH229
using Plots
f(x)=x
theme(:dark)
plot(f,-5,5,linewidth=5,c=:hotpink,legend=false,arrow=true)
Here is a picture of the output:
plot
How do I get the arrow to appear on both ends of the line instead of just one?
The plot and plot! commands have an arrow parameter that in turn has a special option :both to have arrows on both ends. Hence you can just do
plot(f,-5,5,linewidth=5,c=:hotpink,legend=false,
arrow=Plots.Arrow(:open, :both, 2.5, 2.0))
It's a bit of a hacky solution, but for the example in the question:
plot!([-4.99,-5],[f(-4.99), f(-5)],
linewidth=5,c=:hotpink,legend=false,arrow=true)
adds the reverse arrow. Generalizing to any chart is pretty straight forward. The idea is to draw a line chart with a reverse direction, for just a tiny bit at the location of the reverse arrow and let Plot add the reverse arrow.

Alignment Error When Using Stacked Bars

I'm using a Stacked bars visualisation on one of my Spotfire pages, but whatever the reason, the bars start to get misaligned with the axis as can be seen on the attached image:
The event Start Time is 125.45, but is been shown after 125.5.
A couple of other images to show it better.
This one, it looks like the value (blue box) is correct (237.7 right before 238).
The green box, which is right on top of the previous, has the same 237.7 value but is after 238. How can that be?
Any idea of how to fix that?
without looking at your entire analysis, it's a bit of a guessing game. my gut tells me that your label expression generating the 125.45 is probably not the same as your X Axis expression, or that your Color By expression is providing you unexpected results. I would look at the preceeding segments on that bar and try to determine why they aren't adding up correctly.
Spotfire wouldn't tell you that the start point is at 140 instead of 125 unless there is some reason to. that it doesn't match the tooltip label is indicative of a different expression.

Put Y-Axis along x=0 line in Bokeh figure

I would like to have my y-axis go right up through the x=0 line in my figure, rather than have it on the left side. Is there an easy way to achieve this with Bokeh?
Currently not available in Bokeh, as of 0.12.1. There is an open issue for this feature.
Have seen someone visually faking it using spans when replicating this infographic - but note labels still off to the left.
Here's the mailing list discussion: https://groups.google.com/a/continuum.io/forum/#!topicsearchin/bokeh/fivethirtyeight/bokeh/_dKphJePDwg
I was attempting to do this and it looks like there is now a solution to this. You can set the figure.yaxis.fixed_location attribute to zero.
As an explicit example using bokeh 1.0.4:
# ... bokeh imports
p = figure(plot_width=300, plot_height=300)
p.patch([-1,0,1], [-1,1,0.5], alpha=0.5)
p.yaxis.fixed_location = 0
show(p)
returns the figure:
You can also do this for the x-axis or both.

Changing axis endpoints in iTorch plot

I'm trying to graph some data in an iTorch notebook. I can generate plots fine, but I want to change the endpoints of the axes. (My autogenerated y-axis is from 20-100, but I'd rather it be from 0-100 since it's a graph of percentages and I want the lower left corner to be the origin.)
I looked in the documentation, and in the list of methods implemented, and in the source code, but didn't find anything that lets me do this. I can zoom the generated graph, but it preserves aspect ratio, so I can't zoom just one of the axes.
Does anyone know how to do this? I'm half convinced this isn't implemented, but it seems like a very strange feature to leave out.
You can change the axis scale by mouse-scrolling over the axis ticks, and translate by drag-and-drop.
I know it's not ideal, but I had the same problem and that's the best I could find so far.

How to center an R plot after removing axis labels

I'm working on visualizing a matrix in R (almost exactly like http://reference.wolfram.com/mathematica/ref/MatrixPlot.html), and I've been using
image(<matrix>,axes=FALSE)
to draw the picture. However, I noticed that with the y-axis turned off, the plot isn't centered--the space is still there for the axis ticks + label. I can finagle some centering with
par(oma=c(0,0,0,2.5))
but this seems inefficient and error-prone (if my matrix were to change dimensions/become non-square). Is there a better way to force the graphic to center?
Reference image http://img694.imageshack.us/img694/9891/metropolis.png
The right hand margin is significantly smaller than the left.
Does
par(mar=c(5,2,4,2))+0.1
help?

Resources