How to improve a Likert plot function ?

Hi ,
my question is based on this function:

The function is called " myPanelFunc()", and is very good, but when I have got 0.00% response for a particular question level (likert Scale),

the numbers are getting squeezed:


How to improve this function in order not to display 0.00% at all if there was no answer at the specific empty level of a question, given by respondents ?

Any help would be very much appreciated, thank you.

Without more of a reprex it is not immediately clear how to help. I am assuming this is some factor level and my advice would be to write a check to drop a factor level if it is not present in a column. In that way it will only show 4 labels and their values.

Thank you @GreyMerchant,

all the reprex there is on SO site that I linked.

This is not good solution for all plot but very good for one item only.
My question is how to force a function not to display 0.0% values.
this is all I want.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.