Community Profile # Dave B

### MathWorks

Last seen: Today Active since 2020

I am a software engineer at MathWorks. My work focuses on graphics and charting.

#### Statistics

All
• • • • • • • • • • #### Content Feed

View by

loop with subplot in MATLAB
The first loop creates a figure for each cell, but the next too loops don't. Did you want a figure for each cell? acceleration=...

alrededor de 2 meses ago | 0

| accepted

Plotting a graph with different colors depending on different vectors
You can plot multiple vectors by either: passing them into plot as a matrix, plot will make a line for each column of the matri...

3 meses ago | 0

Geographical maps in Matlab
How about something like this? paris = [48.5 2.2 46]; london = [51.5 0.1 48]; newyork = [40.7 -74 54]; natick = [42.3 -71.3...

3 meses ago | 0

UI doesn't show buttongroups but doesn't give any error
The problem you're running into is just the order in which you set Units and Position: bg(i).bg = uibuttongroup(fig,'Title',['S...

3 meses ago | 1

error in the code
It looks like you're passing in a matrix, but I think you want to pass in a vector. Try transposing t? t=linspace(0,2,16000)'...

3 meses ago | 0

Converting text to datetime stamp in Data Table
It's a little difficult to understand exactly what's in TMX2DataFile3TCs25through48 from the code, I think the dates you pasted ...

3 meses ago | 0

I want to have specific values on y-axis of the plot.
To set the y tick values, you can use the YTick property on the Axes. You can use gca and set to apply these to the current axes...

3 meses ago | 1

need help for adding a error bar
I think the problem you ran into was that you were calling errorbar with 4x4 matrices for x and y, and 1x12 vectors for yneg and...

3 meses ago | 0

| accepted

Combining two surfaces from two files into one surface plot
Do you mean two different .fig files? You can generally find objects that live in an axes with findobj, which is good for look...

3 meses ago | 0

| accepted

Data overlapping when plotting stacked bar graphs
The data aren't overlapping, you're simply seeing the effect of a log scale, which is a little strange for a stacked bar. The va...

3 meses ago | 0

Aligning axes labels in 3D plots
The differrence between your labels and the axes is because MATLAB stretches an axes to fill the space of its container - if you...

3 meses ago | 2

| accepted

how to display/table numbers and letters
I think this is what you're trying to produce? z=[1;2;3;4;5;6]; Gz = nan(size(z)); Gz(z<4) = log(10./(4-z(z<4))); Gz(z==4)...

3 meses ago | 0

how to copy a figure with a figure inside it using Matlab?
I think you just copied the small axes into the same position, making them into big axes (and putting them on top). In other wor...

3 meses ago | 0

| accepted

How to plot z component as a colorbar with lines connecting scatter plot points?
I think what you're asking for is a color gradient on the line? Unfortunately lines don't have color gradients. A common workaro...

3 meses ago | 0

| accepted

change color for specifics bars
I didn't fully understand your explanation of which colors you want where, but really all you have to do is set CData as you lik...

3 meses ago | 0

| accepted

plot of y = 2.*(x.^4 - x.^2) isn't right
I'm pretty sure that's correct, were you expecting to see more of a w-like shape? You might have to zoom in a bit for that (and ...

3 meses ago | 2

Separate y & x axis
There are some submissions on file exchange for this, like this one: https://www.mathworks.com/matlabcentral/fileexchange/57366-...

3 meses ago | 0

Colours of a Histogram
If you're specifying the counts, could you use bar instead of histogram? bar has a CData property for this purpose. The limits w...

3 meses ago | 0

| accepted

Opening multiple figures from directory and extracting X and Y data simultaneously
@Daynah Rodriguez: The problem that jumps out in this code is: ii = find(0.7 < y < 1.0,1); This makes sense mathematicall...

3 meses ago | 0

| accepted

How do I use tiledlayout when each plot is made within a subroutine?
You're seeing the error because when tiledlayout is in charge of positioning axes, it doesn't let you do it. It looks to me lik...

3 meses ago | 1

95% uncertainty bounds
If you have 100 simulations per day, and you want to use your simulations to estimate 2.5% to 97.5% around the median (a 95% con...

4 meses ago | 0

Plotting grouped box plot of varying lengths
First of all, if you use boxchart (released in R2020a) you'll have a bit more flexibility than the old boxplot function. The ...

4 meses ago | 0

Stackedplot axes XLabel = ('Raman shift [cm^{-1}]') (superscript) not working
Unfortunately stackedplot doesn't let you control the interpreter for the XLabel, so you can't use tex like you can for a regula...

4 meses ago | 1

| accepted

how to separate a matrix into 2 vectors
You can do this pretty easily with some indexing. Here's an example with some random data: m = [rand(10,2) randi(2,10,1)-1] ...

4 meses ago | 0

| accepted

Replotting a 2D graph on a 3D surface keeps all 3 axes
cla doesn't reset the view. Here are some options: Set the view explicitly: view(app.UIAxes, 2) Call cla with the reset fl...

4 meses ago | 1

| accepted

Change stackedplot YLabel?
The DisplayLabels property gives you access to the y labels: sp=stackedplot(rand(10,4)); set(sp, 'DisplayLabels',["Apples" "Or...

4 meses ago | 0

| accepted

Loop-free histogramming of each column of an input matrix
This is somewhere between workaround and hack, but you could do it with histcounts2: X=rand(5); a=histcounts2(X,ones(5).*(1:5)...

4 meses ago | 0

| accepted

Label 0 in a semilog plot
You can fake the tick labels, but setting the TickLabels property, but another way to do this is to use 2 axes. I like doing thi...

5 meses ago | 1

| accepted

I can't read UIAxis Exponent value
This actually isn't quite the bug you've identified, although I'm surprised by the behavior: The (automatically calculated, not...

5 meses ago | 1

| accepted