@@ -50,6 +50,14 @@ define([
5050 x_limit_to : '' ,
5151 y_limit_from : '' ,
5252 y_limit_to : '' ,
53+ xticks : '' ,
54+ xticks_label : '' ,
55+ xticks_rotate : '' ,
56+ removeXticks : false ,
57+ yticks : '' ,
58+ yticks_label : '' ,
59+ yticks_rotate : '' ,
60+ removeYticks : false ,
5361 // info options
5462 title : '' ,
5563 x_label : '' ,
@@ -621,6 +629,8 @@ define([
621629 let {
622630 chartType, data, x, y, hue, setXY, userOption= '' ,
623631 x_limit_from, x_limit_to, y_limit_from, y_limit_to,
632+ xticks, xticks_label, xticks_rotate, removeXticks,
633+ yticks, yticks_label, yticks_rotate, removeYticks,
624634 title, x_label, y_label, legendPos,
625635 useColor, color, useGrid, gridColor, markerStyle,
626636 userCode1,
@@ -680,6 +690,56 @@ define([
680690
681691 let generatedCode = com_generator . vp_codeGenerator ( this , config , state , etcOptionCode . join ( ', ' ) ) ;
682692
693+ // Axes
694+ if ( x_limit_from != '' && x_limit_to != '' ) {
695+ chartCode . appendFormatLine ( "plt.xlim(({0}, {1}))" , x_limit_from , x_limit_to ) ;
696+ }
697+ if ( y_limit_from != '' && y_limit_to != '' ) {
698+ chartCode . appendFormatLine ( "plt.ylim(({0}, {1}))" , y_limit_from , y_limit_to ) ;
699+ }
700+ if ( legendPos != '' ) {
701+ chartCode . appendFormatLine ( "plt.legend(loc='{0}')" , legendPos ) ;
702+ }
703+ if ( removeXticks === true ) {
704+ // use empty list to disable xticks
705+ chartCode . appendLine ( "plt.xticks([])" ) ;
706+ } else {
707+ let xticksOptList = [ ] ;
708+ if ( xticks && xticks !== '' ) {
709+ xticksOptList . push ( xticks ) ;
710+ // Not able to use xticks_label without xticks
711+ if ( xticks_label && xticks_label != '' ) {
712+ xticksOptList . push ( xticks_label ) ;
713+ }
714+ }
715+ if ( xticks_rotate && xticks_rotate !== '' ) {
716+ xticksOptList . push ( 'rotation=' + xticks_rotate )
717+ }
718+ // Add option to chart code if available
719+ if ( xticksOptList . length > 0 ) {
720+ chartCode . appendFormatLine ( "plt.xticks({0})" , xticksOptList . join ( ', ' ) ) ;
721+ }
722+ }
723+ if ( removeYticks === true ) {
724+ // use empty list to disable yticks
725+ chartCode . appendLine ( "plt.yticks([])" ) ;
726+ } else {
727+ let yticksOptList = [ ] ;
728+ if ( yticks && yticks !== '' ) {
729+ yticksOptList . push ( yticks ) ;
730+ // Not able to use xticks_label without xticks
731+ if ( yticks_label && yticks_label != '' ) {
732+ yticksOptList . push ( yticks_label ) ;
733+ }
734+ }
735+ if ( yticks_rotate && yticks_rotate !== '' ) {
736+ yticksOptList . push ( 'rotation=' + yticks_rotate )
737+ }
738+ // Add option to chart code if available
739+ if ( yticksOptList . length > 0 ) {
740+ chartCode . appendFormatLine ( "plt.yticks({0})" , yticksOptList . join ( ', ' ) ) ;
741+ }
742+ }
683743 // Info
684744 if ( title && title != '' ) {
685745 chartCode . appendFormatLine ( "plt.title('{0}')" , title ) ;
@@ -690,15 +750,6 @@ define([
690750 if ( y_label && y_label != '' ) {
691751 chartCode . appendFormatLine ( "plt.ylabel('{0}')" , y_label ) ;
692752 }
693- if ( x_limit_from != '' && x_limit_to != '' ) {
694- chartCode . appendFormatLine ( "plt.xlim(({0}, {1}))" , x_limit_from , x_limit_to ) ;
695- }
696- if ( y_limit_from != '' && y_limit_to != '' ) {
697- chartCode . appendFormatLine ( "plt.ylim(({0}, {1}))" , y_limit_from , y_limit_to ) ;
698- }
699- if ( legendPos != '' ) {
700- chartCode . appendFormatLine ( "plt.legend(loc='{0}')" , legendPos ) ;
701- }
702753 // Style - Grid
703754 // plt.grid(True, axis='x', color='red', alpha=0.5, linestyle='--')
704755 let gridCodeList = [ ] ;
@@ -712,7 +763,6 @@ define([
712763 chartCode . appendFormatLine ( "plt.grid({0})" , gridCodeList . join ( ', ' ) ) ;
713764 }
714765
715- let convertedData = data ;
716766 if ( preview ) {
717767 // Ignore warning
718768 code . appendLine ( 'import warnings' ) ;
@@ -728,7 +778,9 @@ define([
728778 code . appendLine ( chartCode . toString ( ) ) ;
729779 } else {
730780 code . appendLine ( generatedCode ) ;
731- code . appendLine ( chartCode . toString ( ) ) ;
781+ if ( chartCode . length > 0 ) {
782+ code . append ( chartCode . toString ( ) ) ;
783+ }
732784 }
733785
734786 if ( userCode1 && userCode1 != '' ) {
0 commit comments