oj | Downloading sample cases | Learning library
kandi X-RAY | oj Summary
Support
Quality
Security
License
Reuse
- Add a subparser to the subparser
- Format a log record
- Run the tool
- Return an argument parser
- Construct a relationship between two files
- Format a string with a percentage
- Match directory with given format
- Register the explorer
- Glob a directory with the given format
- Creates a new requests session with the given cookies
- Return a list of paths to drop backup or hidden files
- Return a pretty - printed diff string
- Render tokens
- Tokenize the output of a pretty diff
- Decode the content of the given content
- Create a path based on a format
- Generates pretty - printed file content
- Tokenize large file content
- Check if the tokens are empty
oj Key Features
oj Examples and Code Snippets
Trending Discussions on oj
Trending Discussions on oj
QUESTION
I am looking at a query from crystal reports and it shows a table name immediately followed by a table name. see below if that didn't make sense but I am trying to understand what this syntax is/does? thank you in advance for any insight
select * from {oj ((table_name table_name inner join ......))}
ANSWER
Answered 2022-Apr-01 at 19:24The 2nd name is the alias. It allows you to refer to the table using a different name. For example, you may want to shorten the references to that table throughout the rest of the statement in order to make things more readable. Or, more importantly, you may want to use the same table twice in the same statement (in which case an alias is required).
QUESTION
I am solving a problem on leetcode OJ where i had to use a custom comparator for set in C++.
typedef pair,int> ppi;
class comp
{
public:
bool operator()(const ppi & p1, const ppi & p2)
{
if(p1.first.first == p2.first.first)
{
if(p1.first.second == p2.first.second) return p1.second > p2.second;
else return p1.first.second > p2.first.second;
}
else
return p1.first.first > p2.first.first;
}
};
this is giving me an error when i am trying to delete an element from the set, which looks like:
set customStack;
.
.
.
customStack.erase({{currentFrequency, currentAddress},val});
error:
In file included from prog_joined.cpp:1:
In file included from ./precompiled/headers.h:50:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/map:60:
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:779:4: error: static_assert failed due to requirement 'is_invocable_v, int> &, const std::pair, int> &>' "comparison object must be invocable as const"
static_assert(
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:1997:31: note: in instantiation of member function 'std::_Rb_tree, int>, std::pair, int>, std::_Identity, int>>, comp, std::allocator, int>>>::_S_key' requested here
if (_M_impl._M_key_compare(_S_key(__x), __k))
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:2534:38: note: in instantiation of member function 'std::_Rb_tree, int>, std::pair, int>, std::_Identity, int>>, comp, std::allocator, int>>>::equal_range' requested here
pair __p = equal_range(__x);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_set.h:685:21: note: in instantiation of member function 'std::_Rb_tree, int>, std::pair, int>, std::_Identity, int>>, comp, std::allocator, int>>>::erase' requested here
{ return _M_t.erase(__x); }
^
Line 39: Char 25: note: in instantiation of member function 'std::set, int>, comp, std::allocator, int>>>::erase' requested here
customStack.erase({{currentFrequency, currentAddress},val});
^
1 error generated.
after added 'const' in the comparator (line 4):
class comp
{
public:
bool operator()(const ppi & p1, const ppi & p2)const
this worked for me.
What is the reason for adding that extra keyword?
ANSWER
Answered 2022-Mar-19 at 07:18By adding that const
to the end of that member function you're making it a const member function, meaning that it cannot possibly modify any of your member variables. Because calling a non-const member function could modify the object, you can't call it if the object is const.
std::set
's erase member function requires that operator() be const to stop it from modifying the object's in their set without you realizing.
If any member function can be const then it should be const, just like any variables you declare or take in as arguments.
QUESTION
I am solving a problem on LeetCode:
Given an unsorted array of integers
nums
, return the length of the longest consecutive elements sequence. You must write an algorithm that runs inO(n)
time. So fornums
=[100,4,200,1,3,2]
, the output is4
.
The Union Find solution to solve this is as below:
class Solution {
public:
vector parent, sz;
int find(int i) {
if(parent[i]==i) return i;
return parent[i]=find(parent[i]);
}
void merge(int i, int j) {
int p1=find(i);
int p2=find(j);
if(p1==p2) return;
if(sz[p1]>sz[p2]) {
sz[p1]+=sz[p2];
parent[p2]=p1;
} else {
sz[p2]+=sz[p1];
parent[p1]=p2;
}
}
int longestConsecutive(vector& nums) {
sz.resize(nums.size(),1);
parent.resize(nums.size(),0);
iota(begin(parent),end(parent),0);
unordered_map m;
for(int i=0; ires) {
res=sz[i];
}
}
return res;
}
};
This gets accepted by the OJ (Runtime: 80
ms, faster than 76.03%
of C++ online submissions for Longest Consecutive Sequence), but is this really O(n)
, as claimed by many answers, such as this one? My understanding is that Union Find is an O(NlogN) algorithm.
Are they right? Or, am I missing something?
ANSWER
Answered 2022-Mar-14 at 07:33They are right. A properly implemented Union Find with path compression and union by rank has linear run time complexity as a whole, while any individual operation has an amortized constant run time complexity. The exact complexity of m
operations of any type is O(m * alpha(n))
where alpha
is the inverse Ackerman function. For any possible n
in the physical world, the inverse Ackerman function doesn't exceed 4. Thus, we can state that individual operations are constant and algorithm as a whole linear.
The key part for path compression in your code is here:
return parent[i]=find(parent[i])
vs the following that doesn't employ path compression:
return find(parent[i])
What this part of the code does is that it flattens the structure of the nodes in the hierarchy and links each node directly to the final root. Only in the first run of find
will you traverse the whole structure. The next time you'll get a direct hit since you set the node's parent to its ultimate root. Notice that the second code snippet works perfectly fine, but it just does redundant work when you are not interested in the path itself and only in the final root.
Union by rank is evident here:
if(sz[p1]>sz[p2]) {...
It makes sure that the node with more children becomes the root of the node with less children. Therefore, less nodes need to be reassigned a new parent, hence less work.
Note: The above was updated and corrected based on feedback from @Matt-Timmermans and @kcsquared.
QUESTION
I am finalizing the representation of my dataset using ggplot2 and for the sake of clarity I would need a coloring scheme that defies standard ggplot2 "logic". Below is a fake dataset to show you my needs in essence:
df2 <- data.frame(supp=rep(c("VC", "OJ"), each=3),
dose=rep(c("D0.5", "D1", "D2"),2),
len=c(6.8, 15, 33, 4.2, 10, 29.5))
head(df2)
supp dose len
1 VC D0.5 6.8
2 VC D1 15.0
3 VC D2 33.0
4 OJ D0.5 4.2
5 OJ D1 10.0
6 OJ D2 29.5
Here is the basic representation I'm using giving the plot below:
ggplot(data=df2, aes(x=dose, y=len, fill=supp)) +
geom_bar(stat="identity", position=position_dodge())
What I would need is to apply a presonalized color palette (myPalette <- c("#05eb92", "#119da4", "#ffc857")
) only to the VC
series, while coloring OC
series Black. Below is the expected plot I need. I am aware that this coloring scheme defies ggplot2 "logic" but I was wondering whether there is an easy way to apply it to my needs. Thanks.
ANSWER
Answered 2022-Mar-12 at 13:01I would create a dummy
variable in your input df2
for the ggplot
fill
aesthetic. Here, "-999" refers to "OJ" and will be coloured in black.
I've also updated your myPalette
to include black in it, and also setNames
to it so that only "-999" will have a corresponding "black" value.
library(tidyverse)
df2 <- data.frame(supp=rep(c("VC", "OJ"), each=3),
dose=rep(c("D0.5", "D1", "D2"),2),
len=c(6.8, 15, 33, 4.2, 10, 29.5))
myPalette <- c("#05eb92", "#119da4", "#ffc857")
myPalette_with_black <- setNames(c(myPalette, "black"),
c(as.character(seq_along(myPalette)), "-999"))
df2 <- df2 %>%
group_by(supp) %>%
mutate(dummy = ifelse(supp == "VC", as.character(row_number()), "-999"))
ggplot(data=df2, aes(x=dose, y=len, fill = dummy)) +
geom_bar(stat="identity", position=position_dodge()) +
scale_fill_manual(values = myPalette_with_black) +
theme(legend.position = "none")
Created on 2022-03-12 by the reprex package (v2.0.1)
QUESTION
I cannot show a list retrieved by Algolia when I am using --release mode in Flutter. It's very interesting that it works just fine when running the app in Flutter Web Debug. Can anyone help me out with this issue?
Works with:
[✓] Flutter Web Debug
[✓] Postman
Error I got in Web Console:
js_helper.dart:1137 Uncaught TypeError: Cannot read properties of undefined (reading 'h')
at Object.bf4 (VM939 main.dart.js:27309:16)
at VM939 main.dart.js:52638:25
at b_W.a (VM939 main.dart.js:5429:62)
at b_W.$2 (VM939 main.dart.js:46761:14)
at aZB.$1 (VM939 main.dart.js:46755:21)
at abu.oj (VM939 main.dart.js:47823:32)
at aQY.$0 (VM939 main.dart.js:47180:11)
at Object.EG (VM939 main.dart.js:5562:40)
at av.u7 (VM939 main.dart.js:47112:3)
at a64.dj (VM939 main.dart.js:46750:8)
Flutter Version (Channel stable, 2.10.0, on macOS 12.1 21C52 darwin-x64, locale en-US)
Snipped code: Algolia call function:
Future getEmployee(String name) async {
AlgoliaQuery query = algolia.instance
.index(employeeIndexName)
.facetFilter('companyId:${userController.user.companyId}')
.query(name);
AlgoliaQuerySnapshot snap = await query.getObjects();
return snap;
}
Reveal in list:
FutureBuilder(
future: AlgoliaService().getEmployee(searchQuery),
builder: (BuildContext context,
AsyncSnapshot snapshot) {
if (snapshot.hasError) {
return Text('Something went wrong');
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(),
);
}
return Text("No errors");
)
ANSWER
Answered 2022-Feb-22 at 05:46I had the same issue.
In case anyone is looking for an immediate fix, what worked for me was to force the use of 1.0.2 dependency instead of 1.0.4:
dependencies:
algolia: '1.0.2'
This is an open issue.
QUESTION
Here is are my menu items, and I want to filter only the Drinks in a drink Component, I am displaying both the 'Drinks' and 'Eat' under categories. And my goal is to only filter and extract the 'Drinks' as I am displaying the drinks on its own component.
Here is my data:
const MenuItems: MenuItems[] = [
{
category: "Drinks",
price: 2,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Coffee",
description: "A blend of coffee beans from La Bolsa in Colombia.",
},
{
category: "Drinks",
price: 2,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "OJ",
description: "Cold pressed and freshely squeezed orange juice.",
},
{
category: "Drinks",
price: 2,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Tea",
description: "Cold pressed and freshely squeezed orange juice.",
},
{
category: "Drinks",
price: 2,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Iced",
description: "Choice of Earl Grey, GreenTea, Chamomile, or Peppermint.",
},
{
category: "Drinks",
price: 4,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Latte",
description: "2 shots of espresso served with steamed milk of choice.",
},
{
category: "Eats",
price: 14,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "FCC Classic",
description:
"Three cage-free eggs cooked any style and with bacon. Includes hash browns and toast.",
},
{
category: "Eats",
price: 14,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "3 Egg Omelet",
description:
"Three cage-free eggs with Mushrooms, Peppers, Onions. Served with hash browns and toast.",
},
{
category: "Eats",
price: 14,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Corned Beef Hash",
description:
"Our signature shredded hash mixed with grass-fed, dry-rubbed, corned beef, caramelized poblanos and onions, topped with two cage-free eggs; your style, & toast.",
},
{
category: "Eats",
price: 12,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "OMG French Toast!",
description:
"Fresh brioche stuffed with mascarpone and topped with vanilla crème, caramel, fresh strawberries, and toasted coconut.",
},
{
category: "Eats",
price: 9,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Buttermilk Pancakes",
description:
"Buttermilk pancakes topped with whipped butter and powdered sugar served with Slopeside Pure Vermont Maple Syrup.",
},
{
category: "Eats",
price: 12,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "FCC Ham Benedict",
description:
"Our Signature English muffin topped with fresh smashed avocado, Parmesan cheese, ripened tomatoes, two poached cage free-eggs, smoked cheddar hollandaise and everything spice.",
},
{
category: "Eats",
price: 12,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Avocado Benny",
description:
"Our Signature English muffin topped with fresh smashed avocado, Parmesan cheese, ripened tomatoes, two poached cage free-eggs, smoked cheddar hollandaise and everything spice.",
},
{
category: "Eats",
price: 13,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "FCC Avocado Toast",
description:
"Rustic bread toasted with olive oil, smashed avocado, onion honey jam, and roasted tomato. Topped with two cage-free sunny side up eggs with a side Dijon citronette, Spiced Pepitas & Parmesan-dressed greens.",
},
{
category: "Eats",
price: 12,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Veggie Smash",
description:
"Griddled, smashed sweet potatoes, a cage-free poached egg, avocado, pickled onions, paprika, drizzled with black pepper maple syrup and topped with our asparagus mushroom salad.",
},
{
category: "Eats",
price: 13,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Garden Omelet",
description:
"Three cage-free eggs with sauteed asparagus, mushrooms, zucchini and red bell peppers. Topped with chili-lime seasoned avocado and goat cheese.",
},
{
category: "Eats",
price: 12,
url: "https://res.cloudinary.com/dlsacnkot/image/upload/v1634070429/test.jpg",
name: "Tofu Veggie Scramble",
description:
"Tofu seasoned with onion powder, salt & pepper; scrambled with choice of three fillings, served with hash browns and toast.",
},
];
export default MenuItems;
interface MenuItems {
category: string;
price: number;
url: string;
name: string;
description: string;
}
Here is my Drinks Component
import MenuItems from "./MenuItems";
const Drinks = (props) => {
return {props.MenuItems.name} ;
};
export default Drinks;
Here is my main Menu Component, and my map and filter functions.
{MenuItems.filter((item) => "Drinks").map((item) => {
return ;
})}
Output:
Coffee OJ Tea Iced Latte FCC Classic 3 Egg Omelet Corned Beef Hash OMG French Toast! Buttermilk Pancakes FCC Ham Benedict Avocado Benny FCC Avocado Toast Veggie Smash Garden Omelet Tofu Veggie Scramble
Only want the "drinks" to show, not the "Eats".
ANSWER
Answered 2022-Jan-24 at 00:01MenuItems.filter((item) => "Drinks")
return always true
What you should be doing is comparing the category to drinks.
MenuItems.filter((item) => item.category === "Drinks")
QUESTION
HTML structure is as shown below,
How do I write Xpath to get to input class = "text-input-entry" under oj-input-text class = "input", for the label-hint = "pfg"
I thought something like this would work but it does not
//div [@class = "items"]/oj-input-text [@class = "input", @label-hint = "pfg"]/input [@class = "text-input-entry"]
ANSWER
Answered 2022-Jan-19 at 19:59Use Chrome DevTools -> Inspect -> Copy -> Copy XPath This will give you an example of how to build the XPath. i.e. The XPath of your question's code: //*[@id="question"]/div/div[2]/div[1]/pre[1]/code
QUESTION
I'm running macOS 11.6,LibreOffice 7.2.2.2,HSQLDB (my understanding is this is v.1.8, but don't know how to verify)
I'm a newbie to SQL, and I'm trying to write a DB to maintain a club membership roster. I'm trying to find everyone in the DB to whom renewal letters should be sent. The quirk is, if a person has never paid in the past, they should be sent a renewal letter. Old members who haven't renewed recently don't get a renewal, and obviously, each individual should only get one letter. I've created a toy example to display the problem I'm having...
Members table:
Key (Integer, Primary key, Autoincrement)
Name (Varchar)
+-----+----------+
| Key | Name |
+-----+----------+
| 0 | Abby |
| 1 | Bob |
| 2 | Dave |
| 3 | Ellen |
+-----+----------+
Payments table:
Key (Integer, Primary Key, autoincrement)
MemberKey (Integer, foreign key to Member table)
Payment Date (Date)
+-----+-----------+--------------+
| Key | MemberKey | Payment Date |
+-----+-----------+--------------+
| 0 | 0 | 2020-05-23 |
| 1 | 0 | 2021-06-12 |
| 2 | 1 | 2016-05-28 |
| 3 | 2 | 2020-07-02 |
+-----+-----------+--------------+
The only way I've found to include everyone is with a LEFT JOIN. The only way I've found to pick the most recent payment is with MAX. The following query produces a list of everyone's most recent payments, including people who've never paid:
SELECT "Members"."Key", "Members"."Name", MAX( "Payments"."Payment Date" ) AS "Last Payment"
FROM { oj "Members" LEFT OUTER JOIN "Payments" ON "Members"."Key" = "Payments"."MemberKey" }
GROUP BY "Members"."Key", "Members"."Name"
It returns the result below, which includes all members only once (Abby has 2 payments but only appears once with the most recent payment). Unfortunately it still includes people like Bob who've been out of the club so long that we don't want to send them a renewal notice.
+-----+----------+--------------+
| Key | Name | Last Payment |
+-----+----------+--------------+
| 0 | Abby | 2021-06-12 |
| 1 | Bob | 2016-05-28 |
| 2 | Dave | 2020-07-02 |
| 3 | Ellen | |
+-----+----------+--------------+
Where I hit a wall is when I try to perform any kind of conditional operation on the Last Payment, to determine whether it's recent enough to include in the list of renewal notices. For instance, in HSQLDB, the query below returns the error, "The data content could not be loaded. Not a condition." The only change in this query from the 1st one is the addition of the WHERE clause.
SELECT "Members"."Key", "Members"."Name", MAX( "Payments"."Payment Date" ) AS "Last Payment"
FROM { oj "Members" LEFT OUTER JOIN "Payments" ON "Members"."Key" = "Payments"."MemberKey" }
WHERE "Last Payment" >= '2020-01-01'
GROUP BY "Members"."Key", "Members"."Name"
The desired output should look like this:
+-----+----------+--------------+
| Key | Name | Last Payment |
+-----+----------+--------------+
| 0 | Abby | 2021-06-12 |
| 2 | Dave | 2020-07-02 |
| 3 | Ellen | |
+-----+----------+--------------+
I've been digging around the web trying anything that looks relevant. I've tried "HAVING" clauses--I can make them work with a COUNT(*) function, but I can't make them work with a MAX(*) function. I've tried using my 1st query as a subquery, and applying the WHERE clause on "Last Payment" in the main query. I've tried solutions people say work in MySQL, but I can't get them to work in HSQLDB. I tried using the 1st query as a View, and writing a query against the View. I've tried a dozen other things I don't even remember. Everything past the 1st query above throws an error. I wanted to include my toy DB, but can't find a way to attach it to the post.
Can anyone help please?
ANSWER
Answered 2021-Dec-30 at 10:11This worked for me.
SELECT "Members"."Key", "Members"."Name", MAX( "Payments"."Payment Date" ) AS "Last Payment"
FROM {oj "Members" LEFT OUTER JOIN "Payments" ON "Members"."Key" = "Payments"."MemberKey"
WHERE "Payments"."Payment Date" >= '2020-01-01'
OR "Payments"."Payment Date" IS NULL}
GROUP BY "Members"."Key", "Members"."Name"
SELECT "Members"."Key", "Members"."Name", MAX( "Payments"."Payment Date" ) AS "Last Payment"
FROM { oj "Members" LEFT OUTER JOIN "Payments" ON "Members"."Key" = "Payments"."MemberKey" }
WHERE "Payments"."Payment Date" >= '2020-01-01'
OR "Payments"."Payment Date" IS NULL
GROUP BY "Members"."Key", "Members"."Name"
Perhaps the problem you were having is that "Last Payment" is only a column title and not the actual name of any column.
QUESTION
Here's my redux configuration:
userSlice.js
import { createSlice } from "@reduxjs/toolkit";
const initialState = {
name: "",
email: "",
avatar: "",
id: "",
};
export const userSlice = createSlice({
name: "user",
initialState: initialState,
reducers: {
setUser: (state, action) => {
return {
...state,
name: action.payload.name,
email: action.payload.email,
avatar: action.payload.avatar,
id: action.payload.id,
};
},
},
});
export const { setUser, logout } = userSlice.actions;
export default userSlice.reducer;
store.js
import { configureStore } from "@reduxjs/toolkit";
import userSlice from "./slices/userSlice";
export const store = configureStore({
reducer: {
user: userSlice,
},
});
app.js
Here's some conext:
I Log in then put values into the user slice through the response of the fetch
const newUser = {
name: oj.name,
email: oj.email,
avatar: oj.avatar,
id: oj.sub,
};
dispatch(setUser(newUser));
After Logging in, I console.log these values this way:
const user = useSelector((state) => state.user);
console.log(user)
And this is what it shows:
Object {
"avatar": "url",
"email": "asd",
"id": "61bcf738e954f7ffc11d507d",
"name": "Asd",
}
I want to update name
from "name": "Asd"
to "name": "bill"
without changing the others and this is my try:
const newUser = {
name: "bill"
};
dispatch(setUser(newUser));
It works, but then the other propeties(email, avatar, id) become undefined. So how can I update a single value without touching the others?
ANSWER
Answered 2021-Dec-24 at 00:45You can use the spread operator to merge the existing state with your new payload.
Currently, you overwrite the name
, email
, avatar
, and id
properties:
return {
...state,
name: action.payload.name,
email: action.payload.email,
avatar: action.payload.avatar,
id: action.payload.id,
};
This will merge only the included properties:
return {
...state,
...action.payload,
};
QUESTION
Morning, I have a little problem with my ggplot
graph.
For some reason, I can't see right now, the y axis ticks and numbers are missing. Maybe, I'm missing something really obvious here or it's something in my settings. The toothgrowth dataset does not really fit the graph, but you can still see the problem (normally facet_wrap
is included, but it does not work with this dataset).
library(tidyverse)
library(ggbeeswarm)
library(gghalves)
library(tidyr)
library(ggplot2)
library(ggpubr)
theme_set(theme_bw(16))
data <- ToothGrowth
a<- ggplot(data, aes(x=supp, y=len)) +
geom_half_boxplot(
data = data %>% filter(supp=="OJ"),
aes(x = supp, y = len, fill=supp), outlier.color = NA) +
scale_fill_manual(values=c("#F2F2F2", "#999999"))+
geom_half_boxplot(
data = data %>% filter(supp=="VC"),
aes(x = supp, y = len, fill=supp), side = "r", outlier.color = NA) +
geom_line(aes(group=supp, colour = supp), position = position_dodge(0.2), alpha = 0.3) +
geom_point(aes(group=supp, colour = supp),size=1,shape=21, position = position_dodge(0.2)) +
scale_color_manual(values=c("chartreuse3", "yellow2",
"firebrick3"))+
# facet_wrap(~ supp)+
# theme(
# strip.background = element_blank(),
# strip.text.x = element_blank())+
theme(plot.margin=unit(c(0,0,0,0),"cm"))+
scale_y_discrete(name ="Name")+
theme(text = element_text(size=11))+
theme(legend.position = "none")
a
ANSWER
Answered 2021-Dec-15 at 08:43Shouldn't your y axis be continuous?
scale_y_continuous(name ="Name")
Then you can add the limits and ticks positions as you want:
scale_y_continuous(name="Name",limits=c(min,max), breaks=c(a,b,c,d))
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install oj
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page