Giter Site home page Giter Site logo

Octave and CamelCase about matlab2tikz HOT 6 CLOSED

matlab2tikz avatar matlab2tikz commented on May 30, 2024
Octave and CamelCase

from matlab2tikz.

Comments (6)

nschloe avatar nschloe commented on May 30, 2024

Well, we'd need something that works for both. How about using lower()?

from matlab2tikz.

bpabbott avatar bpabbott commented on May 30, 2024

I agree. Using "lower()" is a good idea.

I emailed a patch to you at the address [email protected]. The title is "patch for CamelCase". Did you get it?

from matlab2tikz.

nschloe avatar nschloe commented on May 30, 2024

My UA mail account is terribly slow -- you better delete that one and use my Gmail actually. Even better (more git-ty, easier to manage for me) of course would be to create a pull request (http://help.github.com/pull-requests/).

from matlab2tikz.

bpabbott avatar bpabbott commented on May 30, 2024

Does the gmail account have the same user name?

Thanks for the info on the pull-request. I'll give that a try ... might take me a while ... depending upon free time.

from matlab2tikz.

bpabbott avatar bpabbott commented on May 30, 2024

I'll try 3 approaches. First one below.

    diff --git a/src/matlab2tikz.m b/src/matlab2tikz.m
    index 52b5c03..e214dfb 100644
    --- a/src/matlab2tikz.m
    +++ b/src/matlab2tikz.m
    @@ -2578,12 +2578,12 @@ function [ m2t, env ] = drawColorbar( m2t, handle, alignmentOptions )
       % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       % set position, ticks etc. of the colorbar
       loc = get( handle, 'Location' );
    -  switch loc
    -      case { 'North', 'South', 'East', 'West' }
    +  switch lower( loc )
    +      case { 'north', 'south', 'east', 'west' }
               userWarning( m2t, 'Don''t know how to deal with inner colorbars yet.' );
               return;

    -      case {'NorthOutside','SouthOutside'}
    +      case {'northoutside','southoutside'}
               cbarOptions = [ cbarOptions,                          ...
                                sprintf( 'width=%g%s, height=%g%s',  ...
                                          parentDim.x.value, parentDim.x.unit,   ...
    @@ -2593,7 +2593,7 @@ function [ m2t, env ] = drawColorbar( m2t, handle, alignmentOptions )
                                sprintf( 'ymin=%g, ymax=%g', [0,1] )         ...
                              ];

    -          if strcmp( loc, 'NorthOutside' )
    +          if strcmp( lower( loc ), 'northoutside' )
                   cbarOptions = [ cbarOptions,                            ...
                                   'xticklabel pos=right, ytick=\empty' ];
                                   % we actually wanted to set pos=top here,
    @@ -2607,7 +2607,7 @@ function [ m2t, env ] = drawColorbar( m2t, handle, alignmentOptions )
                                    % pos=left does the same thing, really.
               end

    -      case {'EastOutside','WestOutside'}
    +      case {'eastoutside','westoutside'}
               cbarOptions = [ cbarOptions,                          ...
                                sprintf( 'width=%g%s, height=%g%s',  ...
                                          width.value      , width.unit,  ...
    @@ -2616,7 +2616,7 @@ function [ m2t, env ] = drawColorbar( m2t, handle, alignmentOptions )
                                sprintf( 'xmin=%g, xmax=%g', [0,1] ),        ...
                                sprintf( 'ymin=%g, ymax=%g', clim )          ...
                              ];
    -          if strcmp( loc, 'EastOutside' )
    +          if strcmp( lower( loc ), 'eastoutside' )
                    cbarOptions = [ cbarOptions,                           ...
                                    'xtick=\empty, yticklabel pos=right' ];
                else
    @@ -2667,11 +2667,11 @@ function [ m2t, env ] = drawColorbar( m2t, handle, alignmentOptions )
           pngFileName      = fullfile( pathstr, [name '-colorbar' num2str(m2t.colorbarNo) '.png'] );
           pngReferencePath = fullfile( m2t.relativePngPath, [name '-colorbar' num2str(m2t.colorbarNo) '.png'] );
           strip = 1:length(cmap);
    -      switch loc
    -          case {'NorthOutside','SouthOutside'}
    +      switch lower( loc )
    +          case {'northoutside','southoutside'}
                   xLim = clim;
                   yLim = [0, 1];
    -          case {'WestOutside','EastOutside'}
    +          case {'westoutside','eastoutside'}
                   strip = strip(end:-1:1)';
                   xLim = [0,1];
                   yLim = clim;
    @@ -2688,13 +2688,13 @@ function [ m2t, env ] = drawColorbar( m2t, handle, alignmentOptions )
           for i=1:m
               [m2t, badgeColor] = rgb2tikzcol( m2t, cmap(i,:) );

    -          switch loc
    -              case {'NorthOutside','SouthOutside'}
    +          switch lower( loc )
    +              case {'northoutside','southoutside'}
                       x1 = clim(1) + cbarLength/m *(i-1);
                       x2 = clim(1) + cbarLength/m *i;
                       y1 = 0;
                       y2 = 1;
    -              case {'WestOutside','EastOutside'}
    +              case {'westoutside','eastoutside'}
                       x1 = 0;
                       x2 = 1;
                       y1 = clim(1) + cbarLength/m *(i-1);
    @@ -3030,38 +3030,38 @@ function [ m2t, lOpts ] = getLegendOpts( m2t, handle )
       loc  = get( handle, 'Location' );
       dist = 0.03;  % distance to to axes in normalized coordinated
       anchor = [];
    -  switch loc
    -      case 'NorthEast'
    +  switch lower( loc )
    +      case 'northeast'
               % don't anything in this (default) case
    -      case 'NorthWest'
    +      case 'northwest'
               position = [dist, 1-dist];
               anchor   = 'north west';
    -      case 'SouthWest'
    +      case 'southwest'
               position = [dist, dist];
               anchor   = 'south west';
    -      case 'SouthEast'
    +      case 'southeast'
               position = [1-dist, dist];
               anchor   = 'south east';
    -      case 'North'
    +      case 'north'
               position = [0.5, 1-dist];
               anchor   = 'north';
    -      case 'East'
    +      case 'east'
               position = [1-dist, 0.5];
               anchor   = 'east';
    -      case 'South'
    +      case 'south'
               position = [0.5, dist];
               anchor   = 'south';
    -      case 'West'
    +      case 'west'
               position = [dist, 0.5];
               anchor   = 'west';
    -      case 'Best'
    +      case 'best'
               % TODO: Implement this one.
               % The position could be determined by means of 'Position' and/or
               % 'OuterPosition' of the legend handle; in fact, this could be made
               % a general principle for all legend placements.
               userWarning( m2t, [ ' Option ''Best'' not yet implemented.',         ...
                              ' Choosing default.' ] );
    -      case 'BestOutside'
    +      case 'bestoutside'
               % TODO: Implement this one.
               % For comments see above.
               userWarning( m2t, [ ' Option ''BestOutside'' not yet implemented.',  ...
    @@ -4292,19 +4292,19 @@ function pos = correctColorbarPos( colBarHandle, axesHandlesPos )
       refAxesId  = getReferenceAxes( loc, colBarPos, axesHandlesPos );
       refAxesPos = axesHandlesPos(refAxesId,:);

    -  switch loc
    -      case { 'North', 'South', 'East', 'West' }
    +  switch lower( loc )
    +      case { 'north', 'south', 'east', 'west' }
               userWarning( m2t, 'alignSubPlots:getColorbarPos',                     ...
                             'Don''t know how to deal with inner colorbars yet.' );
               return;

    -      case {'NorthOutside','SouthOutside'}
    +      case {'northoutside','southoutside'}
               pos = [ refAxesPos(1), ...
                       colBarPos(2) , ...
                       refAxesPos(3), ...
                       colBarPos(4)       ];

    -      case {'EastOutside','WestOutside'}
    +      case {'eastoutside','westoutside'}
               pos = [ colBarPos(1) , ...
                       refAxesPos(2), ...
                       colBarPos(3) , ...
    @@ -4328,30 +4328,30 @@ function refAxesId = getReferenceAxes( loc, colBarPos, axesHandlesPos )
           return;
       end

    -  switch loc
    -      case { 'North', 'South', 'East', 'West' }
    +  switch lower( loc )
    +      case { 'north', 'south', 'east', 'west' }
               userWarning( m2t, 'Don''t know how to deal with inner colorbars yet.' );
               return;

    -      case {'NorthOutside'}
    +      case {'northoutside'}
               % scan in `axesHandlesPos` for the handle number that lies
               % directly below colBarHandle
               [m,refAxesId]  = min( colBarPos(2) ...
                                     - axesHandlesPos(axesHandlesPos(:,4)<colBarPos(2),4) );

    -      case {'SouthOutside'}
    +      case {'southoutside'}
               % scan in `axesHandlesPos` for the handle number that lies
               % directly above colBarHandle
               [m,refAxesId]  = min( axesHandlesPos(axesHandlesPos(:,2)>colBarPos(4),2)...
                                 - colBarPos(4) );

    -      case {'EastOutside'}
    +      case {'eastoutside'}
               % scan in `axesHandlesPos` for the handle number that lies
               % directly left of colBarHandle
               [m,refAxesId]  = min( colBarPos(1) ...
                                 - axesHandlesPos(axesHandlesPos(:,3)<colBarPos(1),3) );

    -      case {'WestOutside'}
    +      case {'westoutside'}
               % scan in `axesHandlesPos` for the handle number that lies
               % directly right of colBarHandle
               [m,refAxesId]  = min( axesHandlesPos(axesHandlesPos(:,1)>colBarPos(3),1) ...

from matlab2tikz.

nschloe avatar nschloe commented on May 30, 2024

I just commited what you'd send me by mail.

from matlab2tikz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.