Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom labels in colorbar #895

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

RPeschke
Copy link
Contributor

added support for custom Tick labels on color bar

code:

f= figure();
h=pcolor(peaks);

hcb=colorbar;
set(hcb,'YTick',[-6 0 6 ],'YTickLabel',{'Good','Normal','Bad'})
matlab2tikz('figurehandle',f,...
    'filename','example_colorMap.tex' ,...
    'showInfo', false,...
    'standalone', true);
close(f)

without the Changes:
example_colormap_without

With the changes:
example_colormap_with

@matlab2tikzBot
Copy link

Can a developer please verify this PR for testing?

@miscco
Copy link
Contributor

miscco commented May 10, 2016

@matlab2tikzBot please test this

@@ -4500,6 +4500,34 @@ function warnFacetedInterp(m2t)
end
end
% ==============================================================================
function cbarStyleOptions = getColotBarTicks(handle, cbarStyleOptions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a typo in the function name.

@miscco
Copy link
Contributor

miscco commented May 10, 2016

Thank you very much for that PR. That is a good usecase and will definitely improve m2t.

However, I think the code is not there yet. Especially considering that we already have an infrastructure for TickLabels. From a glance at

function [options] = getAxisTicks(m2t, handle, axis, options)

I would guess, that you could achieve all that you want by passing an empty "axis" argument. Maybe we will need some checks against that but I think that might be a suitable approach.

@RPeschke
Copy link
Contributor Author

Thanks for your succession I found that all the functionality was already in the project I just needed to apply it to this axis label type.

axisOptions = opts_add(axisOptions, strtrim(['colorbar ', cbarTemplate]));


%color map ticks
[m2t, options] = getAxisOptions(m2t, handle, 'y');
Copy link
Contributor

@miscco miscco May 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can just pass cbarStyleOptions directly.

[m2t, cbarStyleOptions] = getAxisOptions(m2t, handle, 'y', cbarStyleOptions);

Then there is no need to merge below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally getAxisOptions assumes that options is a valid container, so that would break most likely

@miscco
Copy link
Contributor

miscco commented May 10, 2016

I am unsure about the attached pdf/jpg. They generally do not make thatmuch sense if you are not a developer.

@egeerardyn thoughts?

@egeerardyn
Copy link
Member

@miscco I agree. Attaching the produced output makes little sense for a normal user, I would say. So it's probably better to remove them from the repository.

@egeerardyn egeerardyn changed the title Color map custum label Custom labels in colorbar May 21, 2016
@okomarov
Copy link
Member

We should add the feature to getColorbarOptions() mostly as is, and eventually clean up the code in another PR.

For this, we need:

  • drop the .pdfs and .png
  • drop opts_append_unique(), not sure what purpose irt serves, since it's not used
  • adapt one of the existing ACID example to use custom colorbar labels, akin to the provided example. We do not want proliferation of test cases...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants