Grouped Bar Plot with Multiple Numeric Fill Variables - ggplot2

I'm used to creating grouped bar plots like this:
new_data<-data%>%
mutate(new_variable=ifelse(variable<100, "Low", "High"))
ggplot(gap,aes(x=random_variable, fill=new_variable))+geom_bar()
Basically I create an additional column that distinguishes any numeric value in the original column I'm using for this example called "variable," and then using "ifelse" it knows how to categorize the new column called "new_variable"
However, can someone please help me separate the fill into three or more levels, for example:
<10, 10-19, 20-59, 50-100, >100
and then generate a grouped bar plot with multiple filled variables based on these numeric conditions?

Related

How to convert a panel bar chart to multi-line chart in tableau

I am trying to create multi-line subplots such that each subplot represents a rating factor on which firms are rated, and each line represents a firm's change in rating over time. Note that I don't have the date field. I have a string field that says which quarter of the year the Mean of ratings belong to.
I'm new to tableau and I created something like this:
I want to create multiple subplots: one subplot for each of the 8 rating features in the above diagram, and the subplot has multiple lines representing the variation over time for each company. I have 10 companies.
Please guide me on how to achieve this?
A rough sketch of how I Imagine the plot to look like is below:
This will teach you how to make a panel chart in Tableau: https://tarsolutions.co.uk/blog/build-a-dynamic-panel-chart-in-tableau/
It shouldn't to too complex for what you're attempting (fingers crossed!).
Building the panel chart is a little tricky in Tableau. Not terribly hard once you understand table calcs. I suggest starting simpler by moving Measure Names from the Rows shelf to the Pages shelf, then creating the line charts you want - 1 per page. Then learn about table calc partitions and addressing, including “At the Level” to have the info needed to define the panels
To make a colored line chart,
You need one field on columns that you set to display as continuous, making it green. If it is a date field, right click on the field and choose from the second set of groups, like month or quarter.
You need a continuous field on the Rows shelf, use Measure Values in your case
Use a discrete field on color to determine the number of lines, say Shortname
Set the Mark Type to either Automatic or line

How to make a dynamic tableau x-axis that gets changed when a different dimension is selected as a filter?

I am trying to create a report for my stakeholders where we want to check the distribution by values of column1, column2 and likewise. While I could make different tabs for each column, I apparently have 55 columns (all numeric and I will be making bins for them) that the user want to toggle between for comparison on distributions - and coming up with an insight like column 43 is more skewed than column19.
Pet example:
1. Suppose I have data in below format:
2. And I want to create a tableau filter enabling the user to toggle between continents and countries, and get their individual distributions in the same view. I want to keep the measure consistent (population in this example). Something like below:
3. and generating distribution by continent when continent is selected and by country when country is selected
I know if I had wanted to toggle between different measures for the same dimension, then I needed to create parameters, but this is opposite to it (same measure but different dimensions) and I am not able to figure out.
Any comment/help will be much appreciated.
I'm afraid you'd still need to use parameters. There is no equivalent of Measure Names for dimensions so you'll have to create a parameter (I called it Dimension Switch) with Continent, Country, etc. as options and a calculated field that will look something like this:
CASE Dimension Switch
WHEN "Continent" THEN [Continent]
WHEN "Country" THEN [Country]
END
This calculated field will take on the values of whichever column you have selected in the Dimension Switch parameter.

Spotfire calculated column based on filter

I want to create a calculated column that is equal to the percent of the total of the previous column, but only for the rows that are selected.
For example, the two columns below show rows where I've filtered for only the rows of interest. The sum is accurate, but I want the percent of the total to be only out of sum of the currently selected rows rather than the absolute total (which is how it's currently being calculated). I want the percent of the total to dynamically change depending on what is filtered in the data table. Is this possible?
Image of my 2 columns:
I know spotfire somehow calculates this becuase when I insert a bar graph using % of Total(SumofComponents) the ratio is only out of the current total.
Image of my bar chart:
much like in programming, Spotfire has a rough concept of scope. and unfortunately, calculated columns are above filters in terms of scope; they have no concept of what is and is not filtered.
visualizations themselves, however, do*!
what you can do in this case is to put your expression on the Y axis (it looks like you've done this), and it will respect your selected filters*.
*caveats: there are a few ways that filtering can be negated on a given visualization:
Properties>>Appearance>>Show shadows indicating the unfiltered data. this option shows a grey bar that represents the data hidden by whatever filter selection was made
Properties>>Data>>Limit data using filterings. these options allow the viz to use separate filtering sets ("Filter Schemes" as they're called in Spotfire) or none at all (to ignore filters completely)
Properties>>Subsets. by default there are three subsets: "All Data" which ignores filters, "Not in current filtering" which inverts the filter selection (e.g., if you filter a boolean column to show only TRUE, this chart would show only FALSE), and "Current filtering" which is the default behavior. you can check the online help for additional subsets that you can add.

How to pivot a line graph in SSRS

I have the following dataset:
Which creates the following line graph with Roletype as the category group and experience as the value:
How can I pivot this graph so Roletype is on the y axis and values are on the x axis?
I think you are actually using an area chart rather than a line chart, but both function the same way. The y-axis measures a numerical value. You indicate what is on the y-axis by placing something in the values area. If you use a field that isn't a number, it's going to try to sum it or count it or aggregate it in some way. You should use a different chart type to effectively display non-numerical data (see this article about choosing the correct chart type). If you want to assign values to your role-types and then display the description on the axis you could do that. I wouldn't necessarily recommend it as an effective way to communicate your message.
To show use the values for the y-axis, add the role-type values field to your dataset. Use that in the values for your chart and aggregate by avg. Follow the instructions in the accepted answer here. You basically set the number type for your vertical axis labels to custom and then add the list of possible values. This only works if you know exactly what values you are expecting.

Combining data from different columns into a line graph with SSRS

Hi I am new to SSRS and I am trying to create a line graph from the following dataset that has a single line and I am confused with how to achieve this simple task.
column1|column2|column3
1,11,35
If I try and add column 1-3 as values it will show nothing because it is trying to do a separate line per column.
I have tried making a temp table in sql and reformatting it as follows:
values
1
11
35
This works however this causes me to lose the axis names for each value.
How can I achieve a single line in my line graph as well as keeping the axis names?
You're correct in that you need separate rows (i.e. pivoting your data) to meet your chart requirements.
You can need to add another column to your new Dataset to have group names, too:
Just example names, obviously.
In your chart, add the Series and Category as required:
Now you have labels on the axis: